2D Arrays: Creation and Access

AP Computer Science A· difficulty 3/5

int[][] m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int rows = m.length;
int cols = m[0].length;
System.out.println(rows + "," + cols);

What is printed?

  • A

    3,3

  • B

    12,0

  • C

    3,4

    check_circle
  • D

    4,3

Explanation

There are 3 rows and 4 columns.

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

Related questions