What is the default capacity of an `ArrayList` when created with the no-argument constructor?

Java Professional Easy

Java Professional — Easy

What is the default capacity of an `ArrayList` when created with the no-argument constructor?

Key points

  • The default capacity of an ArrayList is 10 when no size is specified.
  • This default capacity can be increased as elements are added to the ArrayList.
  • Specifying a larger initial capacity can help optimize performance.

Ready to go further?

Related questions