🎴 Flashcard Mode

Java and Python Programming Fundamentals Quiz

Card1 / 20
Mastered0
Review0
QuestionClick to flip

By using which method ,How can one increase size of an ArrayList?

AnswerClick to flip back
A
ensureCapacity(int minCapacity)
💡 Explanation:

ArrayList uses ensureCapacity(int minCapacity) to request internal capacity expansion before adding elements. This is an optimization to avoid multiple internal array resizes. Option A's 'incSize' and option C's 'incCapicity' (misspelled) don't exist in the API.

Change Mode