Question: difference between equals and hashcode() where it we need to override?
Answer: if you override equals, you must override hashCode. hashCode must generate equal values for equal objects. equals and hashCode must depend on the same set of significant fields . You must use the same set of fields in both of these methods.