做项目时犯二没有搞清楚优先级的问题从而暴露出一个Integer相加而产生的类型转换的问题

Integer a;

Integer b;

Integer c;

c=  a+b==null?a:b;

java编译器报 The operator == is undefined for the argument type(s) int, null 的错误,改为:

c=  a+(b==null?a:b);之后错误就没有了,这是不是可以说明Integer+Integer=int呢

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案