So first, consider this 1. Since the main method is a static Java virtual machine, it can invoke it without creating any instance of the class that contains the main method.
this is: 2. Everything that is declared in the class in Java is of the reference type and requires that the object be created before they are used, but the static method and static data are loaded into separate memory inside the JVM, called the context that is created when the class is loaded. If the main method is static, it will be loaded in the JVM context and available for execution.
and finally, this: 3. The main method is the entry point for any Core Java program. Execution begins with the main method.
So, in conclusion: Java first charges your main method, public makes this method externally accessible to the JVM, and static sets this method in the context of the JVM, so the first thing the JVM loads on your main method!
Class Hello{}
just make your class available to all classes from one package.
Nivde 04 Sep '13 at 15:49 2013-09-04 15:49
source share