Get Started
968

Q: When do you override hashcode and equals() ?

  • Show 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.

The Most Comprehensive Exam Preparation Platform

Get the Examsbook Prep App Today