Many tutorials say that Hashtable doesnt allow null values,but i tried like
hashtable.put(" ","red");
and able to display it by using Object get(Object key);
and also i want to know whether Hashtable allow duplicates.
I think the only diff b/w HashMap and Hashtable is Hashtable is synchronized.
Naveen kumar.s wrote:Many tutorials say that Hashtable doesnt allow null values,but i tried like
hashtable.put(" ","red");
and able to display it by using Object get(Object key);
" " is not a null value, it is a valid String with a single space. "" is also a valid empty String. Try putting null.