这代码哪里有问题,要如何修改
public static void main(String[] args){
Map<Integer.Integer>mapA = new HashMap<>();
Map<Integer.Integer>mapB = new HashMap<>();
for(int i = 0;i <150; i++){
mapA.put(i,i);
mapB.put(i,i);
}
for(int i = 0 ; i <150; i++){
System.out.println(i+""+(mapA.get(1) == mapB.ger(i)));
}
}
这代码哪里有问题,要如何进行修改
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
Winson.J 2021-10-13 16:14关注代码不能运行,还是运行结果不对?
不能运行,要贴出报错信息
结果不对,你的预期是什么,实际是什么,贴出来Map<Integer.Integer> 两个Integer之间是逗号
System.out.println(i+""+(mapA.get(1) == mapB.ger(i))); 这一行,后面一个ger(i)不对,应该是get(i);第一个get()参数是 “i”不是1;当然是1也能运行。单结果不是你想要的本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 1无用