Why main method is marked as public?
问题 I have a question that why main method is marked as public ? According to an answer on stackoverflow, It is declared as static "The method is static because otherwise there would be ambiguity: which constructor should be called?" But, can anyone can explain why it is declared public always? 回答1: The initialization software that starts your program must be able to see main so that it can call it. 回答2: Because the JLS, Section 12.1.4, says so: The method main must be declared public, static,