Multiple main() methods in java

后端 未结 10 639
忘了有多久
忘了有多久 2020-12-28 08:53

I was wondering what the effect of creating extra main methods would do to your code.

For example,

public class TestClass {
    public static void ma         


        
10条回答
  •  孤独总比滥情好
    2020-12-28 09:10

    It won't have an additional main-method, as main is static. So it's once per class.

    If you have multiple main-methods in your project, you will specify which one to launch when starting your application.

提交回复
热议问题