Why is the Java main method static?

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

    If the main method would not be static, you would need to create an object of your main class from outside the program. How would you want to do that?

提交回复
热议问题