To answer this question, let's go through each statement to determine if it is true or false:
A. At the root of the collection hierarchy is a class called Collection - This statement is false. The root of the collection hierarchy is the java.lang.Object
class, not the Collection
class.
B. The collection interface contains a method called enumerator - This statement is false. The Collection
interface does not contain a method called enumerator
. However, it does contain a method called iterator
which returns an iterator over the elements in the collection.
C. The Set interface is designed for unique elements - This statement is true. The Set
interface in Java is designed for collections that contain unique elements. Each element in a Set
must be unique, and duplicate elements are not allowed.
D. The iterator method returns an instance of the Vector class - This statement is false. The iterator
method in the Collection
interface does not return an instance of the Vector
class. Instead, it returns an instance of the Iterator
interface, which is used to iterate over the elements in a collection.
The correct answer is C. The Set interface is designed for unique elements.