The Java main
method must be passed an array of String
s (traditionally named args
). That is, the signature of main
must be
public static main(String[] args)
or
public static main(String... args)
That is the constraint on the code that an application programmer must write.
But is the runtime environment, which "calls" your main
method allowed (according to the language or JVM specification) to provide null
references for args
. That is, is it valid for the runtime environment to start your program in manners equivalent to the following:
MyClass.main(null);
MyClass.main(new String[]{null})