Two Main methods with different signatures

后端 未结 10 1536
旧时难觅i
旧时难觅i 2021-01-18 17:53

I have following class.

public class Test {

    public static void main(Integer[] args) {
        System.out.println(\"This is not a main\"); 
    }   

           


        
10条回答
  •  悲哀的现实
    2021-01-18 17:57

    Because that's what Java always looks for. Java Language Specification, Section 12.1.4:

    The method main must be declared public, static, and void. It must specify a formal parameter (§8.4.1) whose declared type is array of String

提交回复
热议问题