I am new to java i got error in HashMap this is what i tried
Hashmap h=new HashMap();
h.put(1,"java");
h.put(2,"c");
but got error
I am new to java i got error in HashMap this is what i tried
Hashmap h=new HashMap();
h.put(1,"java");
h.put(2,"c");
but got error
use DataTypes Also Like this is the older procedure to store the values in hashmap
HashMap<Integer,String> h=new HashMap<Integer,String>();
h.put(1,"java");
h.put(2,"c");
It will Work
For better quality code and low coupling you should use MAP.
Map<Integer,String> h= new HashMap<>();
h.put(1,"java");
h.put(2,"c");