Hello World!
Sure thing, Spinning The Mill also have the ridiculous, hated and anti-hardcore tutorial known as "Hello World". Still, it's great to see something work!
1. Type or copy the following into your editor:
2. Save file as "Test.java" (spelled exactly like this)
3. Compile it. Tip: Open a commandprompt and find your way to the directory where you saved "Test.java". Type "javac Test.java".
4. Run it by typing: java Test. If succesfull, a hello world greeting will be written.
A few notes on this program:
Class name and file name MUST match. Java is exstremely case-sensitive.
Conventionally class names always starts with a Capital and method names always starts with small letters.
The main(String[] args) method is the starting point for any java application run from a dosprompt. Some other application types (ie. applets) requires another starting method.
The "String[] args" is a string array which contains any arguments given after "java Test".
Ie. "java Test Hello there". In this case "Hello" would be args[0] and args[1] would be "there".
"System.out.println("")" simply writes to the available consol - in this case the commandprompt. I can promise you, this will not be the last time you type this line of code :-)