Science, asked by GajuEstilo3768, 1 year ago

Can we use any class as Map key in Java if yes how, if no then why not?

Answers

Answered by Anonymous
0
It is not necessary that everydifferent object must have different hashcode. hashcode isused to narrow the search result. When we try to insert any key inHashMap first it checks whetherany other object present with same hashcode and if yes then it checks for the equals() method.
Similar questions