HashMap In Java
package one;
import java.util.Map;
public class HashMap {
public static void main(String[] args) {
Map<Integer,String> map=new java.util.HashMap<Integer,String>();
map.put(1,"b1");
map.put(2,"b2");
map.put(3,"b3");
for(Integer i: map.keySet()) {
System.out.println(map.get(i));
}
}
}
import java.util.Map;
public class HashMap {
public static void main(String[] args) {
Map<Integer,String> map=new java.util.HashMap<Integer,String>();
map.put(1,"b1");
map.put(2,"b2");
map.put(3,"b3");
for(Integer i: map.keySet()) {
System.out.println(map.get(i));
}
}
}
Comments
Post a Comment