This week's book giveaway is in the Design and Architecture forum. We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line! See this thread for details.
My understanding is that HashMap can not contain keys . How come the size of the Map in the following code is 5 instead of 3? I thought ob4 and ob3 are duplicates and they can not be inserted as keys.
Please provide What i am missing ? . here is the code
When you override a method, make sure you get the case and signature correct. In this case, the hashCode() method has a capital C.
In the future, to prevent making this mistake, declare overriden methods with the @Override annotation, it will report an error if you are not actually overriding.