Sushil Pathak wrote:please provide me why HasMap contains one null key and how it can be managed please provide solution with example.
First: Welcome to JavaRanch.
Second: In answer to your question - No. That's not how this site works; we expect you to do your own work here.
What I will tell you is that a HashMap (indeed, ANY Map) can only contain one of any key, be it null or anything else. Some Map implementations choose not to allow nulls, and if they don't, there's probably a good reason; but don't expect the designer to tell you. That's what Object-Orientation is all about: hiding information.
Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Read this thread for a better perspective on this aspect of a HashMap. There are many ways to look at a glass of water. One might say it is half full, another might see it as half empty. It is a design issue that prompted the author of this class to take this step. Joshua would be able to answer your query perfectly.