The == operator is a simple comparison of values. For primitives, this is straight forward. For objects, == compares references. In particular, if a and b both reference objects, then a == b will return true only if a and b point to the same object.
The equals method is intended to provide a more meaningful comparison of instances. The method is defined in the base class Object, where it's implemented as a simple comparison of objects. It's up to the programmer to override the equals method to provide the desired behavior for derived classes. It it's not overridden, then equals will simply compare objects (working like ==).
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Something about .... going for a swim. With this tiny ad ...