Java OCA OCP Practice Question 917

Question

What is the output of the following when run as java Count 1 2?

public class MyClass { 
        public static void main(String target[]) { 
           System.out.println(target.length); 
        } 
} 
  • A. 0
  • B. 1
  • C. 2
  • D. The code does not compile.


C.

Note

The name of the program is MyClass and there are two arguments.

Therefore, the program outputs 2, and Option C is correct.




PreviousNext

Related