0
While using integer in the place of int it's working. Why not with int
import java.util.HashMap ; class MyClass { public static void main(String[]args){ //in the below object if I change Integer with int it's working. explain me why it's not working with int HashMap<String,int> f = new HashMap<String,int>(); f.put("senthil",200); f.put("santy",100); System.out.println(f.get("santy")); } }
2 odpowiedzi
+ 6
int will not work because you have to specific an object type not a primitive type. Integer is an wrapper class for int
https://www.sololearn.com/learn/432/?ref=app
0
Because you have specific it an objective type not a primitive type