import java.util.HashMap;
import java.util.Map;
public class HashmapExample {
public static void main(String[] args) {
HashMap<Integer, String> name=new HashMap<Integer, String>();
name.put(1001,"Dx");
name.put(1002,"Ravi");
name.put(1003,"Mitul");
name.put(1004,"Bittu");
name.put(1005,"Dhaval");
for(Map.Entry m:name.entrySet())
{
System.out.println(m.getKey()+" "+m.getValue());
}
}
}
import java.util.Map;
public class HashmapExample {
public static void main(String[] args) {
HashMap<Integer, String> name=new HashMap<Integer, String>();
name.put(1001,"Dx");
name.put(1002,"Ravi");
name.put(1003,"Mitul");
name.put(1004,"Bittu");
name.put(1005,"Dhaval");
for(Map.Entry m:name.entrySet())
{
System.out.println(m.getKey()+" "+m.getValue());
}
}
}
No comments:
Post a Comment