Skip to content
Sharp

Collections · interview question

Which statement about nulls in maps is correct?

Multiple choiceMedium
Choose one answer
Answer and explanation

Correct answer

A. HashMap allows one null key and any number of null values; Hashtable allows neither.

Why

ConcurrentHashMap also rejects nulls. With it, get returning null unambiguously means "absent".

Test yourself on Collections

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

Start free test
All Collections questions →