Hi All,
I got a little better answer from my friend for the Query asked, Please reply if there is anything went wrong!!
Why "null" cannot be used as key value in Hashtable.
The reason is quite simple. Hashtable mandates that the objects used as keys
must implement the hascode method and the equals method. The methods so
implemented by the keys are then used internally by Hashtable for storage and
retrieval. Therefore null cannot be used as keys in Hashtable.
However the HashMap implementation does allow null keys.
In the java.util.HashMap implementation, in case the key is null, it uses a
surrogate object to act as the key. The surrogate key is a dummy non-null
java object. However using a null key in HashMap overwrites the previous
null-key : value mapping.
Thanks to All,
Cheenath.