When do you override hashcode and equals() ?5
1124 5b5cc6c7e4d2b4197774de68
Q: When do you override hashcode and equals() ?
- Show Answer
- Workspace
- Discuss
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.
Similar Questions
Since Nithya and Suganya exchange places, so Rita’s new position is the same as Monika’s earlier position. This position is 17th from the right and 10th from the left. Therefore Number of girls in the row = (16 + 1 + 9) = 26.