PRINTING HASH TABLE
To print all the elements of a hash table is not simple task, here is a sample code to help you in this regardimport java.util.Enumeration;
// create a new Hashtable
Hashtable h = new Hashtable( );
// add some key/value pairs to the Hashtable
h.put( "LA" , "Lahore" );
h.put( "KR" , "Karachi" );
h.put( "MN" , "Multan" );
h.put( "SDK" , "SADIQABAD" );
// enumerate all the contents of the hashtable
Enumeration keys = h.keys();
while ( keys.hasMoreElements() )
{
key = (String)keys.nextElement();
stateName = (String)h.get( key );
System.out.println( key + " " + stateName );
// prints lines of the form LA Lahore
// in effectively random order.
} // end while