Intermediate Java
Q57 / 100

What is the significance of the hashCode() contract?

Correct! Well done.

Incorrect.

The correct answer is B) Equal objects must have the same hashCode

B

Correct Answer

Equal objects must have the same hashCode

Explanation

The contract says: if a.equals(b) is true, then a.hashCode() == b.hashCode(). The reverse is not required; different objects can share a hash code (collision).

Progress
57/100