How can I implement generics in this program so I do not have to cast to String in this line:
String d = (String) h.get ("Dave"); import java.util.*; public class TestHashTable { public static void main (String[] argv) { Hashtable h = new Hashtable (); // Insert a string and a key. h.put ("Ali", "Anorexic Ali"); h.put ("Bill", "Bulimic Bill"); h.put ("Chen", "Cadaverous Chen"); h.put ("Dave", "Dyspeptic Dave"); String d = (String) h.get ("Dave"); System.out.println (d); // Prints "Dyspeptic Dave" } }