Java Main Method
Chapter:
Java Basics
Last Updated:
06-11-2016 16:35:43 UTC
Program:
/* ............... START ............... */
public class JavaMainMethod {
public static void main(String[] args) {
System.out.println("Main method Example ");
}
}
/* ............... END ............... */
Output
Notes:
-
The keyword static allows main() to be called without having to instantiate a particular instance of the class.
- This is necessary since main() is called by the Java interpreter before any objects are made.
- The keyword void simply tells the compiler that main() does not return a value.
Tags
Main Method, Java Basics