Where can I find Java main functions

Is public static void main (string [] args) a built-in or user-defined or overridden function of some classes provided by Java? If you declare or define it in an interface or class, where can you find its declaration?

Solution

JLS 12

Every Java application should have a main () method, and the JVM will look for the main () method when starting the application This is where execution begins No, it's not built-in. You define the main () method in the class, which becomes the starting point of the application The main () method must be public, static, return void, and accept a parameter: a string array Any class with this main () method can be used as a starting point for Java applications

JVM spec 5.2:

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
分享
二维码
< <上一篇
下一篇>>