Skip to content
Sharp

Collections · interview question

Which of the following statements about HashSet is true?

Multiple choiceEasychapter-4-curatedpremiumcollectionsset-interface-and-hashset
Choose one answer
Answer and explanation

Correct answer

C. HashSet allows null elements.

Why

HashSet allows null elements, but it does not maintain insertion order, is not thread-safe by default, and is not a subclass of List.

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →