Straight into the fun stuff, your first program will print a simple message "Hello World" on the screen
class HelloWorld{
public static void main(String args[]{
System.out.println("Hello World");
}
}
Output= Hello World
Now lets break the code down and explain each command
|
Command
|
Meaning
|
| class | program starts |
| Hello World | program name |
| { } | start and end of program |
| public | available to public |
| static | class method |
| void | the method wont return a value |
| main | the name of the method |
| (String[]args) | these are parameters |
| System.out | built in java program |
| println | print line |
| (" ") | literal message |
| ; | end of statement |