// declare & allocate Hashtable, using array notation Hashtable() animal; // set up associations cow => moo, pig => oink animal[ "cow" ] = "moo" ; animal[ "pig" ] = "oink" ; // get, note lack of cast String noise = animal[ cow ]; if ( noise == null ) noise = "don't know" ; // iterate over all animals for each key in animal { System.out.println ( key + " says " + animal[ key ] ); }