Which two statements are true about comparing two instances of the

Loading

Choose the correct option.

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

  1. If the equals() method returns true, the hashCode() comparison == must return true.
  2. If the equals() method returns false, the hashCode() comparison != must return true.
  3. If the hashCode() comparison == returns true, the equals() method must return true.
  4. If the hashCode() comparison == returns true, the equals() method might return true.

A. 1 and 4
B. 2 and 3
C. 3 and 4
D. 1 and 3

Leave a Comment