1Z0-803 · Question #13
Which two are valid declarations of a two-dimensional array?
The correct answer is A. int[][] array2D; D. int[] array2D[];. 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-dime
Question
Which two are valid declarations of a two-dimensional array?
Options
- Aint[][] array2D;
- Bint[2][2] array2D;
- Cint array2D[];
- Dint[] array2D[];
- Eint[][] array2D[];
How the community answered
(16 responses)- A88% (14)
- C6% (1)
- E6% (1)
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.
Topics
Community Discussion
No community discussion yet for this question.