Traversing Arrays

AP Computer Science A· difficulty 3/5

To traverse <code>arr</code> from last to first:

  • A

    for-each

  • B

    for (int i = arr.length; i > 0; i--)

  • C

    for (int i = arr.length - 1; i >= 0; i--)

    check_circle
  • D

    for (int i = 0; i < arr.length; i++)

Explanation

Indices <code>length-1</code> down to 0.

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

Related questions