1.

Which two statements are true about comparing two instances of the same class, given that the and methods have been properly overridden?

Answer» (1) is a restatement of the equals() and hashCode() contract. (4) is true because if the hashCode() comparison returns ==, the two objects might or might not be equal. (2) and (3) are incorrect because the hashCode() method is very flexible in its return values, and often two dissimilar objects can return the same hash code value.


Discussion

No Comment Found