can anyone explain me , why is size 5? What is with key with int & Integer. If i comment both m.put(12,26) and m.put(in,25), size is still 5. What are the behaviour of equals and hashCode methods. although both methods are commented, i can find my object through key?
First of all, the code is printing size of Map before you add last two items in the map. That is why you are getting size 5.
Second, The equals and hashCode methods becomes critical when you use an object of class who or whose superclass implements these methods. As for example, in the same code you have posted, how do you retrieve first three values for which you have used boject of test class as a key?.