It has been a while after my previous post as I'm quite busy lately. Now, let's us get back to our business.
Below is a java sample code for the traditional Hello World program. Basically, the idea behind this Hello World program is to learn how to create a simple java program, compile and run it. To create your java source code you can use any text editor.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Output:
Hello World
Java Main Method Declarations
- public static void main(String[] args){}
- public static void main(String []args){}
- public static void main(String args[]){}
- static public void main(String[] args){}
- public final static void main(String[] args){}
- public static void main(String... args){}
All the 6 above are valid main method's.