Cannot run HelloWorld in Java

Mudshark

Well-Known Member
Joined
Mar 30, 2006
Messages
135
Reaction score
0
Location
Not at a Lagrangian point
So there i was, feeling a bit bored and I decided to check out my coding skills. Havent coded for a looooong time. I downloaded Java (JDK with JRE) and I started with the world famous HelloWorld programming.

I get an error message when I try and compile it. The error message is that the class is not specified. Even when I copy/paste an example of the code, I get the same message. The first line of code is:

public class HelloWorld

Surely this is correct? Can anybody suggest anything? I am out of ideas.
 
Java is very picky about filenames and class names. They must be the same, and in the right place.
Check FILENAME and CLASSNAME are the same.
 
maybe you should start with something simpler

ppppffftttttt!! haha!
 
The error is probably because the name of the .java file and your class name are different..
they "EXPLICITLY" have to be the same.....^_^'

with diff names the 1st line error message will be
public class <classname>

Saying there is something wrong with the class
And since the error is not specified, its referring to the name
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X