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