Can there exist two main methods in a Java program?

后端 未结 16 833
后悔当初
后悔当初 2020-12-08 02:21

Can there exist two main methods in a Java program?

Only by the difference in their arguments like:

public static void main(String[] args)

16条回答
  •  心在旅途
    2020-12-08 03:17

    the possibility of two main(String[] args) methods within the same scope create confusion for the JVM. It fails to use them as overloaded methods. So the signatures in terms of parameters) must be different.

提交回复
热议问题