You are on page 1of 1

public class HashMapSample {

public static void main(String[] arg) {


Map hashMap = new HashMap();
hashMap.put(1, "A");
hashMap.put(2, "B");
hashMap.put("a", "C");
hashMap.put(3, 23);
hashMap.put("b", "D");
System.out.println(hashMap);
Set set = hashMap.keySet();
Iterator it = set.iterator();
while(it.hasNext()){
System.out.println(hashMap.get(it.next()));
}
}
}

You might also like