Traversing 2D Arrays

AP Computer Science A· difficulty 4/5

<code>for (int[] row : m)</code> iterates

  • A

    Each column

  • B

    Each row (which is itself an int[])

    check_circle
  • C

    All elements

  • D

    Compile error

Explanation

Outer for-each yields rows; nest another for-each for elements.

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

Related questions