Objects and Collections

Q1: Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?

A java.util.SortedMap

B java.util.TreeMap

C java.util.TreeSet

D java.util.Hashtable

ANS:D - java.util.Hashtable

Hashtable is the only class listed that provides synchronized methods. If you need synchronization great; otherwise, use HashMap, it's faster.



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.