Basic Java Language: Difference between revisions
wikademia>Cremisis13 |
wikademia>Cremisis13 |
||
| Line 197: | Line 197: | ||
|} | |} | ||
</center> | </center> | ||
=Make a Class= | |||
Since you do not know classes and objects yet, you can put everything like this: | |||
<pre> | |||
public class NAME | |||
{ | |||
public static void main(String args[]) | |||
{ | |||
//CODE HERE | |||
} | |||
} | |||
</pre> | |||
You will also later learn about methods. Note that this file must be saved into NAME.java. You can change NAME to any name you want (that is valid). This way, you can test all of your programs. In the command line, type: | |||
<pre> | |||
javac NAME.java | |||
java NAME | |||
</pre> | |||
Note that NAME is still the program's name! | |||
=Finalizing the Basics= | =Finalizing the Basics= | ||
Let this information sink through before continuing to the next chapter. Take the time to test out some things you learned (see Make a Class). Then you'll really understand some of it.<br><br> | Let this information sink through before continuing to the next chapter. Take the time to test out some things you learned (see Make a Class). Then you'll really understand some of it.<br><br> | ||