Use == to determine if two reference variables refer to the same object. Use equals() to determine if two objects are meaningfully equivalent. If x.equals(y) is true, then x.hashCode() == y.hashCode() is true. If you override equals(), override hashCode().