Can there exist two main methods in a Java program?

后端 未结 16 836
后悔当初
后悔当初 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 02:57

    There can be more than one main method in a single program. But JVM will always calls String[] argument main() method. Other method's will act as a Overloaded method. These overloaded method's we have to call explicitly.

提交回复
热议问题