Question: what is the difference between hashcode and equals in java?
Answer: equals() and hashCode() are different methods and hashCode method should not be used to check if two object references are same. Reason: hashCode just returns int value for an Object, even two different objects can have same hashCode integer. ... equals() checks if the two object references are same.