1.

Why does HashMap allow null whereas HashTable does not allow null?

Answer»

The OBJECTS used as keys must IMPLEMENT the hashCode and equals methods in order to SUCCESSFULLY SAVE and retrieve objects from a HashTable. These methods cannot be implemented by null because it is not an object. HashMap is a more advanced and IMPROVED variant of Hashtable.HashMap was invented after HashTable to overcome the shortcomings of HashTable.



Discussion

No Comment Found