import java.util.Enumeration; import java.util.Hashtable;
public class HashtableTest {
public static void main(String[] args) {
Hashtable h = new Hashtable();
h.put("Willi Frankien", "[email protected]");
h.put("Hugo Meier", "[email protected]");
h.put("Sabine Moll", "[email protected]");
System.out.println("NAME -> ADRESSE");
Enumeration keys = h.keys();
while (keys.hasMoreElements()){
String key = (String) keys.nextElement();
String value = (String) h.get(key);
System.out.println(key + " -> " + value);
}
System.out.println();
System.out.println("Email- Adressen: ");
Enumeration elements = h.elements();
while (elements.hasMoreElements()){
String value = (String) elements.nextElement();
System.out.println(value);
}
}
}