If you use javac myjavaprograms\Hello.java then I believe that java is
looking for a class file called myjavaprograms.Hello.
So it will be easier if you can navigate to the exact folder of the
file you want to compile first. Or you can just call your class:
public class myjavaprograms.Hello{
When we start getting many class files, that makes it easier for us
because we can keep them in different folders.
Tommy
On May 11, 3:48 pm, Forex Trader <[email protected]> wrote:
> Every .java file needs a "public class" inside it in order to compile
> and the file needs to have the same name as the public class (case
> sensitive).
>
> On May 10, 11:20 pm, "[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
-~----------~----~----~----~------~----~------~--~---