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  Reef kaç dolar Binance?

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  What are the 11 methods in object class?

Leave a Reply

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