Examveda

What is the primary difference between a `HashSet` and a `LinkedHashSet` in the Java Collections Framework?

A. A `HashSet` uses a tree structure to store elements

B. A `LinkedHashSet` is synchronized, while a `HashSet` is not

C. A `LinkedHashSet` maintains insertion order, while a `HashSet` does not

D. A `HashSet` allows duplicate elements, while a `LinkedHashSet` does not

Answer: Option C


This Question Belongs to Java Program >> Collections Framework In Java

Join The Discussion

Related Questions on Collections Framework in java