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 ()".

"Hello World!" ( i = 0; i < args.length; i++

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>