This the one of the most common question we used to face during Core Java interview, however its understanding is bit tricky. I will rather take unique approach to make the understanding simple.
So, what is the contract between hashcode and equals to be used as a key to HashMap / HashSet?
Java specification says that if you want to use any object as key to a hashmap or hashset or any other