diff --git a/MapEg.java b/MapEg.java new file mode 100644 index 0000000..bcb2642 --- /dev/null +++ b/MapEg.java @@ -0,0 +1,18 @@ +import java.util.*; +public class MapEg { + public static void main(String args[]) { + Hashtable ht= new Hashtable(); + ht.put("abc","alphabets"); + ht.put("19", "number"); + System.out.println(ht); + System.out.println(ht.contains(19)); + System.out.println(ht.containsKey(19)); + System.out.println(ht.get("abc")); + Enumeration e=ht.keys(); + while(e.hasMoreElements()) { + String key=(String)e.nextElement(); + System.out.println(key + " " + ht.get(key)); + } + } + +}