The JAVA API documentation states that if two objects are equal, then they must have the same hash code, however the opposite is NOT true. But, when both functions run independently, then why this contract?
There are some myths that equals() calls hashcode() internally or vice-versa, but this is not truth. use of equals is straight forward, and hashCode () is used only for hashing capabilities in hash capable collections(i.e HashMap, HashSet) in java.
hashcode() is used to generate 'hash' which is number that is used to index/locate a memory location in a large list of memories("bucket"). So all the equal objects should be found in same bucket so all equal object should have same hashcode. but opposite is not true because a bucket can contains different objects.