Given:
3. public class Main { 4. static public void main(String[] scurvy) { 5. System.out.print(scurvy[1] + " "); 6. main(scurvy[2]); 7. } 8. public static void main(String dogs) { 9. assert(dogs == null); 10. System.out.println(dogs); 11. } }
And, if the code compiles, the command-line invocation:
java Main -ea 1 2 3
What is the result? (Choose all that apply.)
A is correct.
The code is legal.
Traditionally, main()
's String[] argument is named "args", but it's not required.
The second main()
is an overload.
In order to enable assertions, the -ea flag must come before the name of the.
class file to be run, so in this case -ea is treated as the first of the arguments, which are of course loaded into a zero- based array.