Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Can u explain why is it so Commented Dec 5, 2018 at 9:47
  • Because this is one of the contract between equals() and hashCode() method. If two object are not equal according to equals() method then there is no guaranty that their hashCode will be same. Please have look the java doc docs.oracle.com/javase/7/docs/api/java/lang/… Commented Feb 21, 2019 at 13:08