+ 1

What if i filled an array list?

What would happen if i had an array list with a capacity of 10 and i tried to add 11 items to it?

5th Apr 2017, 2:13 AM
Braden Irish
Braden Irish - avatar
2 Antworten
+ 6
That's the advantage of Arraylists over Arrays. They shrink or expand on user requirement. The initial capacity you gave doesn't matter.
5th Apr 2017, 2:25 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 2
it will work. array lists automatically expand as needed. you can try it for yourself in a code
5th Apr 2017, 2:15 AM
Edward