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.
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.