Multiple Choice Question

Quiz Guidelines

 

QID: 
549
Question: 

Given the following program, which statement is true?

class SomeClass{
public static void main( String args[ ] ){
if (args.length == 0 ){
System.out.println("no arguments") ;
}
else{
System.out.println( args.length + " arguments") ;
}
}
}

Select 1 option

A. The program will fail to compile.
B. The program will throw a NullPointerException when run with zero arguments.
C. The program will print no arguments and 1 arguments when called with zero and one arguments.
D. The program will print no arguments and 2 arguments when called with zero and one arguments.
E. The program will print no arguments and 3 arguments when called with zero and one arguments.

Q&A Set: