boolean (Object obj) { if (obj == null || getClass() != obj.getClass()) return false; MyBean other = (MyBean)obj; // In the 'equals' method, comparing fields is no different than anywhere else. return field <warning descr="Object values are compared using '==', not 'equals()'">==</warning> other.field; }