Why is the Java main method static?

前端 未结 30 2663
离开以前
离开以前 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:20

    static - When the JVM makes a call to the main method there is no object that exists for the class being called therefore it has to have static method to allow invocation from class.

提交回复
热议问题