Overriding the equals() and hashCode() methods

The equals() method is inherited from the superclass Object and determines if two instances are equal or equivalent.
Usually this method should be overridden because the equals() method of the Object class is equivalent to the operator ==, which returns true if and only if the two references refer to the same object.