Online Java Compiler By
JavaTpoint.com
import java.util.*; class TestCollection16{ public static void main(String args[]){ Hashtable
hm=new Hashtable
(); hm.put(100,"Amit"); hm.put(102,"Ravi"); hm.put(101,"Vijay"); hm.put(103,"Rahul"); for(Map.Entry m:hm.entrySet()){ System.out.println(m.getKey()+" "+m.getValue()); } } }
Output