Java OCA OCP Practice Question 6

Question

Given the following class:

public class App { 
     public static void main(String[] args) { 
       System.out.println(args.length); 
     } 
} 

Assuming App.class is stored in an appropriate location in file appjar.jar,

what is printed when you type the following command line?

java -cp appjar.jar -ea App  1 2 3 4  
  • A. 4
  • B. 5
  • C. 6
  • D. 7
  • E. 8
  • F. 9


A.

Note

The args array contains command-line arguments that are not directives to the java command.

Only the strings "1", "2", "3", and "4" are passed into args, so args.length is 4.




PreviousNext

Related