34. Relationship between equal method and hashCode method?

Relationship between equal method and hashCode method?

The relationship between equal method and hashCode method is like a contract.

  •  If two objects are equal, they must have the same hashCode
  •  If two objects have the same hashCode, it can equal or not equal

Leave a Reply

Your email address will not be published. Required fields are marked *