ArrayList Methods

AP Computer Science A· difficulty 3/5

<code>list.add(0, 99);</code> does

  • A

    Compile error

  • B

    Inserts 99 at the front; shifts others right

    check_circle
  • C

    Adds to end

  • D

    Sets index 0 to 99 (replaces)

Explanation

Two-arg <code>add(idx, val)</code> inserts at idx.

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

Related questions