ArrayList Methods

AP Computer Science A· difficulty 3/5

<code>list.remove(2);</code> (when list has Integer values)

  • A

    Removes element at index 2 (calls remove(int))

    check_circle
  • B

    Removes the value 2

  • C

    Sets index 2 to null

  • D

    Compile error

Explanation

For an ArrayList<Integer>, <code>remove(int index)</code> is preferred over <code>remove(Integer)</code> for primitive 2.

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

Related questions