Using Hashtable in JDK 1.2.x
Posted on 1999-07-28
I can't seem to get the Hashtable to work as described in the Sun JDK1.2.2 documentation.
private Hashtable users= new Hashtable();
// initial user database (ahem)
// users.put("admin", new Integer(1)); // test this because it's identical to Sun example
users.put("leon", new String("password")); // doesn't work either
// users.put("leon", "password"); // My first attempt. Doesn't work either.
I get the compiler error "Type expected"
users.put("leon", new String("password"));
and it points to just after the first parenthesis, whichever of the above forms I use.
BTW, I'm writing a servlet (not that that should make any difference, should it?)