Analysis of main function in Java
Reprint address:
In Java, the main () method is the entry method for Java applications. The Java virtual machine finds the running program to be started through the main method, and checks whether the class where the main function is located is loaded by the Java virtual machine. If not, the class is loaded, and all related other classes are loaded. Therefore, when the program is running, the first method to execute is the main () method. Normally, if you want to run a method of a class, you must first instantiate an object of the class, and then run the method through "object name. Method name ()". However, since main is the entry of the program, the object has not been instantiated at this time, so the main method is declared as static, In this way, this method can be called directly through "class name. Method name ()".