What happens if you do not override hashCode?

If you don’t override hashcode() then the default implementation in Object class will be used by collections . This implementation gives different values for different objects, even if they are equal according to the equals() method.

Sizin İçin Seçtik  Do I need Java for JDK?

Leave a Reply

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