Check the API description of equals. They may be objects of the same type but they are two different objects in memory, so it is not symmetric. It fails in the definition of equivilence relation so is not equal.
== is a shallow comparison, which only compares the identity.
The == returns true, if the variable reference points to the same object in memory. This is a �shallow comparison�.
equals() method is a deep comparison whick makes use of equals() method to make sure they are logically equal.
The equals() - returns the results of running the equals() method of a user supplied class, which compares the attribute values. The equals() method provides �deep comparison� by checking if two objects are logically equal as opposed to the shallow comparison provided by the operator ==.
If equals() method does not exist in a user supplied class then the inherited Object class's equals() method is run which evaluates if the references point to the same object in memory. The object.equals() works just like the "==" operator (i.e shallow comparison).
Overriding the Object class may seem simple but there are many ways to get it wrong, and consequence can be unpredictable behaviour. [ July 18, 2006: Message edited by: ak pillai ]