I wondering that a Hashmap handle the value once the Key is same. I insert 2 element with same key using put method. if there is no value exist it return null otherwise it return the privous value shored. does hashMap does not store multiple value for same Key
public class geekarray {
HashMap<Integer, String> a ;
geekarray(){
a= new HashMap<Integer,String>(10);
System.out.println(a.put(1, "yogi"));
System.out.println(a.put(1, "yogi2"));
System.out.println(a.put(2, "yogi3"));
}
public static void main(String s[]){
geekarray a = new geekarray();
}
}
Output:-
null
yogi
null