Introduction to ArrayList

AP Computer Science A· difficulty 4/5

<code>new ArrayList<Integer>(100)</code> creates

  • A

    Array of size 100

  • B

    List with internal capacity 100; size = 0

    check_circle
  • C

    List with 100 elements

  • D

    Compile error

Explanation

Constructor argument is initial capacity (avoids early resizing); size is still 0 until add.

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

Related questions