Map<String, Integer> map = new HashMap<String, Integer>();
if(map==null){
System.out.println("map is null");
}else{
int a = map.get("");
System.out.println(a);
}
------解决方案--------------------
这代码会报错吧, map.get("");获得是Integer类型的null然后做转型是会报错的吧
------解决方案--------------------
int a = map.get("");---->Integer a= map.get("");
------解决方案--------------------
出乎意料,报的是 Exception in thread "main" java.lang.NullPointerException