Rahul, I don't you why you suddenly start talking about hash codes, but you cannot use Object.hashCode() or System.identityHashCode(...) to check if two objects are equal.
Sure, if two objects are equal then they will have the same hash code, but two
different objects may also have the
same hash code. Hash codes only work "in one direction", not in both directions. The hash code of an object does
not represent the unique identity of an object.
Read the API documentation of Object.hashCode() for information on how hash codes work in
Java.
[ October 18, 2006: Message edited by: Jesper Young ]