Question 9
Back to Exercise
What happens when you put a null key into a TreeMap that uses natural ordering?
- A It is stored first
- B NullPointerException Correct
- C It is ignored
- D It is stored last
Correct Answer: Option B
The key must be compared with compareTo.
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!