were you able to run the file after compiling..
or did java Hello threw any exception..?

because when you declare a Class as public the name of the file must
same as the class name...
and a file can contain only one public class...

but when you removed the public, the class access is default hence it
does not bother about the file name and so the compile worked but when
you run you should use the name of the class and the name of the
file...(in case if they are different..)

On May 11, 11:20 am, "[email protected]" <[email protected]>
wrote:
> when i type code-1.10:Hello.java by notepad and save to Hello.java
> then run by "Command Prompt" , command "C:\Program Files\java
> \jdk1.6.0_13\bin\javac C:\myjavaprograms\Hello.java"
>
> this step have 1 erros :
> C:\myjavaprograms\Hello.java:2: class Hello is public , should be
> declared in a filesd named Hello.java
>
> When i replace the first line "public class Hello{" by "class Hello
> {" , it create Hello.class
>
> pls tell me why ?

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to