Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers | ||||
| ||||
Ans. General contract of hashCode is: 1.Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, 2.If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. 3.It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  hashcode Asked in 1 Companies expert | ||||
Related Questions | ||||
Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object? | ||||
Write a class and override the equals and hashcode method ? | ||||
How many threads can access a concurrent hashmap when the hashcode is overridden and always returns a zero. | ||||