Let's see the declaration for java.util.HashMap class.
public class HashMap
import java.util.*; class HashMapExample { public static void main(String[] args) { HashMap<Integer,String> hm=new HashMap<Integer,String>(); hm.put(1001,"John"); hm.put(1005,"Smith"); hm.put(1003,"Sachin"); hm.put(1009,"James"); for(Map.Entry m:hm.entrySet()) { System.out.println(m.getKey()+" "+m.getValue()); } } }
Output
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc