public Object get(Object key)
If the key is found for a key-value pair entry, its value will be returned.
If not found, null is returned.
import java.util.Enumeration;
import java.util.Hashtable;
public class MainClass {
public static void main(String[] s) {
Hashtable table = new Hashtable();
table.put("key1", "value1");
table.put("key2", "value2");
table.put("key3", "value3");
Enumeration e = table.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
System.out.println(key + " : " + table.get(key));
}
}
}
key3 : value3
key2 : value2
key1 : value1