Question 4
Back to Exercise
Which statement is part of the contract?
- A Equal hash codes mean equal objects
- B If a.equals(b) is true, a.hashCode() must equal b.hashCode() Correct
- C hashCode must be unique
- D equals must use hashCode
Correct Answer: Option B
Different objects may share a hash code (a collision).
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!