Objects and Collections

Q1: Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?

A java.util.LinkedHashSet

B java.util.List

C java.util.ArrayList

D java.util.HashSet

ANS:D - java.util.ArrayList

All of the collection classes allow you to grow or shrink the size of your collection. ArrayList provides an index to its elements. The newer collection classes tend not to have synchronized methods. Vector is an older implementation of ArrayList functionality and has synchronized methods; it is slower than ArrayList.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.