Why does Hashtable not take a null key?
Also why does HashMap allow null keys?
What is the purpose of making these two classes Key
Hashtable predates the collections framework, and was part of JDK 1.0. At that time null keys were probably considered not useful or not essential, and were thus forbidden. You might see it as a design error, just as the choice of the name Hashtable rather than HashTable.
Then, several years later, came the collections framework, and Hashtable was slightly modified to fit into the framework. But the behavior on null keys was not changed to keep backward compatibility.
Hashtable should be deprecated, IMHO.