₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,237 members, 8,510,814 topics. Date: Saturday, 31 October 2026 at 07:12 AM

Toggle theme

Help With Java Hello World - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Help With Java Hello World (838 Views)

1 Reply (Go Down)

Help With Java Hello World by Laryokeke(op): 4:33pm On Jan 10, 2014
I am not entirely new to programming, as i have a background in Basic and Javascript. however for the past 3 months, i have been learning Java thoroughly to add to my itinery but can't seem to get past the universal Hello World program.

I am using J Creator and have installed the sdk, as well as java jvm.

Now when i put the following code

class MyFirstJavaClass {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
System.out.println(“Chocolate, royalties, sleep”);
}
}


i get ten errors, ranging from "Illegal Expression to "MyHelloWorldClass" not found.

I have researched so thoroughly to resolve this that i have become quite familiar with the syntax of Java...and yet can't make a hello world program.

Can any Javanian help me out of this embarrassing situation? or if J creator is the problem (Like i have begun to suspect), can i be pointed to any other IDE that will not have problems with classes- anything that will spare me the agony of ....any class errors whatsoever!
Re: Help With Java Hello World by Nobody: 6:21pm On Jan 10, 2014
your args should come before the square brackets
Re: Help With Java Hello World by Danyl(m): 7:28pm On Jan 10, 2014
rutchiekens: your args should come before the square brackets
that wouldnt solve the problem. Append "public" to ur main class declaration, den add ur default constructor-public MyFirstJavaClass(){

} before ur main method
2. frm ur experience it shows u saved ur source file as MyHelloWorldClass.java instead of MyFirstJavaClass.java
2b. u shud also split d string literal u supplied as argument to the println method as System.out.println("Chocolate"+" "+","+"Royalties"+" "+" "+"Sleep"wink;
3. rename ur java source file as MyFirstJavaClass.java
Re: Help With Java Hello World by Nobody: 7:48pm On Jan 10, 2014
"MyFirstJavaClass" Is NOT Equal To "MyHelloWorldClass"

Save ur SOURCE Code With your CLASS Name.

Do the correction there .
1 Reply

Learning To Program With Java by the Fulaman • The Beauty & Power Of JavaScript: "Hello World" Code As A Case Study • Developing A Professional Bluetooth Instant Chat Messenger With Java • 2 • 3 • 4

C Programming Training • Connecting To Ms Access On Dropbox • Smart CBT