2D Arrays: Creation and Access

AP Computer Science A· difficulty 3/5

int[][] m = new int[4][5];
System.out.println(m.length * m[0].length);

What is the total number of cells?

  • A

    45

  • B

    25

  • C

    20

    check_circle
  • D

    9

Explanation

4 rows times 5 columns equals 20 cells.

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

Related questions