What equals method must you override?

Why we override equals() method? It needs to be overridden if we want to check the objects based on the property . For example, we want to check the equality of employee object by the id. Then, we need to override the equals() method.

Sizin İçin Seçtik  Can I use == for string?

Leave a Reply

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

What equals () method must you override?

As a side note, when we override equals(), it is recommended to also override the hashCode() method . If we don’t do so, equal objects may get different hash-values; and hash based collections, including HashMap, HashSet, and Hashtable do not work properly (see this for more details).29 Tem 2021

Sizin İçin Seçtik  Can you still mine ETN?

Leave a Reply

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