Skip to content
Medium Java Core Multiple Choice

What happens when you call HashMap.put() with an existing key?

— Tests your understanding of this concept.

Answer Options

A It throws an exception
B It creates a duplicate entry
C It replaces the old value and returns it
D It ignores the new value

Want to see the correct answer?

Get the answer with a detailed explanation, plus practice 20+ more Java Core questions with adaptive quizzes and timed interviews.

See the Answer on Guru Sishya →

This question is from the Java Core topic (Programming Languages).

More Java Core Questions