🎴 Flashcard Mode
Java Programming Fundamentals
Card1 / 15
Mastered0
Review0
QuestionClick to flip
A Vector is declared as follows. What happens if the code tried to add 6 th element to this Vector
AnswerClick to flip back
A
The element will be successfully added
💡 Explanation:
Java's Vector class is dynamically resizable and automatically grows its capacity when needed. Unlike fixed-size arrays, Vector will successfully add elements beyond its initial capacity by internally allocating more space, so adding a 6th element to a Vector initialized with capacity 5 will succeed without throwing an exception.