Skip to content
Sharp

Core Java · interview question

Which Java collection allows you to store key-value pairs, ensuring unique keys?

Multiple choiceEasychapter-4-curatedpremiumcore-javacode-reading-with-collections
Choose one answer
Answer and explanation

Correct answer

A. HashMap

Why

HashMap is designed to store key-value pairs and ensures that each key is unique, which makes it suitable for this requirement.

Test yourself on Core Java

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

Start free test
All Core Java questions →