Which two are valid declarations of a two-dimensional array?
A.
int[][] array2D;
B.
int[2][2] array2D;
C.
int array2D[];
D.
int[] array2D[];
E.
int[][] array2D[];
Explanation:
int[][] array2D; is the standard convention to declare a 2-dimensional integer array. int[] array2D[]; works as well, but it is not recommended.
Incorrect answers:
int[2][2] array2D;
The size of the array cannot be defined this way.
int array2D[]; is good definition of a one-dimensional array. int[] []array2D[];is good definition of a three-dimensional array.
“A,D”
http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.2
The Answer is A, D.
Choice B will not compile. You can’t specify the size of the array dimensions in the array declaration in this manner. The proper way to do this would be int[][] array2D = new int[2][2];
Choice C declares a one-dimensional array.
Choice E declares a three-dimensional array.