What is the relation between equals and hashCode in Java?

hashCode() and equals() contract The basic rule of the contract states that if two objects are equal to each other based on equals() method, then the hash code must be the same , but if the hash code is the same, then equals() can return false.

Sizin İçin Seçtik  What is the need of overriding equals method in Java?

Leave a Reply

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