2D Arrays: Creation and Access

AP Computer Science A· difficulty 2/5

int[][] m = new int[2][3];
System.out.println(m.length + " " + m[0].length);

What is printed?

  • A

    2 3

    check_circle
  • B

    3 2

  • C

    2 2

  • D

    6 0

Explanation

new int[2][3] creates a 2-row, 3-column array. m.length is rows = 2, m[0].length is columns = 3.

Want 10 more like this — adaptive to your weak spots?

Related questions