Why is the Java main method static?

前端 未结 30 2148
离开以前
离开以前 2020-11-22 01:41

The method signature of a Java main() method is:

public static void main(String[] args){
    ...
}

Is the

30条回答
  •  无人共我
    2020-11-22 02:04

    The public static void keywords mean the Java virtual machine (JVM) interpreter can call the program's main method to start the program (public) without creating an instance of the class (static), and the program does not return data to the Java VM interpreter (void) when it ends.

    Source: Essentials, Part 1, Lesson 2: Building Applications

提交回复
热议问题