java - Two Main methods with different signatures -
i have following class.
public class test { public static void main(integer[] args) { system.out.println("this not main"); } public static void main(string[] args) { system.out.println("this main"); } }
in here there 2 main
method accept integer[]
, string []
input argument. question how jvm
load second method main method of class. why consider input argument array
of string
?
because that's java looks for. java language specification, section 12.1.4:
the method main must declared public, static, , void. must specify formal parameter (§8.4.1) declared type array of string
Comments
Post a Comment