Qus:    When do you override hashcode and equals() ?
Dec 25, 2021 04:28 1 Answers Views: 198 ROHAN
Prev Next
Answers (1)
RANJIT Jan 06, 2022 02:59
Answer:   You must override hashCode() in every class that overrides equals(). Failure to do so will result in a violation of the general contract for Object. hashCode(), which will prevent your class from functioning properly in conjunction with all hash-based collections, including HashMap, HashSet, and Hashtable.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect