← BYTES
Java·Starter·Ref: 9.1.15

What is the difference between a Java array and an ArrayList regarding size?

Have a question about this video? Mention reference 9.1.15 when you contact us.

a.They behave identically in every respect
b.Arrays can resize automatically but ArrayLists cannot
c.ArrayLists always have a fixed size too
d.A plain array has a fixed size set at creation; an ArrayList can grow or shrink dynamically as elements are added or removed
Once you create `new int[5]`, that array can never hold more or fewer than 5 slots. ArrayList wraps a resizable internal array, automatically growing its backing storage as needed when you add more elements than it currently has room for.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES9115#Java