hashCode and equals method

Override equals() and hashCode() method in java

In Java, every object has access to the equals() method because it is inherited from the Object class. However, this default implementation just simply compares the memory addresses of the objects. You can override the default implementation of the equals() method defined in java.lang.Object. If you override the equals(), you must override hashCode() otherwise a […]

Scroll to top