Join ExamsbookAnswer :
When do you override hashcode and equals() ?5
Q: When do you override hashcode and equals() ?
- Show AnswerHide Answer
- Workspace
Answer :
Explanation :
HashCode method return int value. So the Hash value is the int value returned by the hash function . If you want to do equality check or want to use your object as key in HashMap, we must override hashcode and equals() method.