Specifications
Sun Services
Java™ Programming Language
Module 6, slide 35 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
The equals Method
• The == operator determines if two references are
identical to each other (that is, refer to the same object).
• The equals method determines if objects are equal but
not necessarily identical.
• The Object implementation of the equals method
uses the == operator.
• User classes can override the equals method to
implement a domain-specific test for equality.
• Note: You should override the hashCode method if you
override the equals method.










