Java OCA OCP Practice Question 550

Question

Which of the following create an empty two-dimensional array with dimensions 2?2?

  • A. int[][] blue = new int[2, 2];
  • B. int[][] blue = new int[2], [2];
  • C. int[][] blue = new int[2][2];
  • D. int[][] blue = new int[2 x 2];


C.

Note

A two-dimensional array is declared by listing both sizes in separate pairs of braces.

Option C correctly shows this syntax.




PreviousNext

Related