Question 1
Back to Exercise
What happens when you put a key that already exists in a HashMap?
- A A duplicate entry is added
- B The old value is replaced, and put returns the old value Correct
- C An exception is thrown
- D The new value is ignored
Correct Answer: Option B
Keys are unique.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!