Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,903 members, 7,806,642 topics. Date: Tuesday, 23 April 2024 at 07:37 PM

Help With Java Hello World - Programming - Nairaland

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

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)

(1) (Reply) (Go Down)

Help With Java Hello World by Laryokeke: 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)

An Easy Way To Watch VOB Movie On The New Ipad / Where Are The African Programmers? Show Yourselves!!! / How Can I Enable Remote Connection To My Mysql Db

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.