2D Arrays: Creation and Access

AP Computer Science A· difficulty 3/5

int[][] m = {{1, 2}, {3, 4}};
m[0][1] = m[1][0] + m[1][1];
System.out.println(m[0][1]);

What is printed?

  • A

    2

  • B

    6

  • C

    7

    check_circle
  • D

    5

Explanation

m[1][0] is 3 and m[1][1] is 4. Their sum 7 is assigned to m[0][1].

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

Related questions

AP Computer Science A · 2D Arrays: Creation and Access Practice Question | Acemy