Java OCA OCP Practice Question 870

Question

How many of the following are legal declarations?

[][] String alpha; 
[] String beta; 
String[][] gamma; 
String[] delta[]; 
String epsilon[][]; 
  • A. Two
  • B. Three
  • C. Four
  • D. Five


B.

Note

As with a one-dimensional array, the braces must be after the type, making alpha and beta illegal declarations.

For a multi-dimensional array, the braces are allowed to be before and/or after the variable name.

They do not need to be in the same place.

The remaining three are correct, and Option B is correct.




PreviousNext

Related