Basic Java Language: Difference between revisions

wikademia>Historybuff
m →Using the Displayer with Variables: added forward ref, clarified literal ref
wikademia>Historybuff
Line 243: Line 243:
To compile your program, go to the directory you saved it. Note that if your class was named NaMe then your file '''must''' be named NaMe.java. Anyways, type: <code>javac NaMe.java</code> where NaMe is your class name. To run, type <code>java NaMe</code>.
To compile your program, go to the directory you saved it. Note that if your class was named NaMe then your file '''must''' be named NaMe.java. Anyways, type: <code>javac NaMe.java</code> where NaMe is your class name. To run, type <code>java NaMe</code>.


Note that if the compiler gives errors with your code, you must fix them.
Note that if the compiler reports syntax errors with your code, you must look in your source code and fix them. These are usually typos, but can be missing colons (;) or other formatting issues.
 
If, when running, it says invalid class file, perhaps the compiler did not create a file. It might have given error messages.


If, when running, it reports invalid class file, the compiler might not have created a file. It should have given an error message at compile time.


=Asking the User=
=Asking the User=