如果返回字段值为null,int类型会报错,Integer不会报错。因为int类型声明的是变量,而null是对象所以会报错。Integer是包装类,包装类符合对象的特征并提供了一些必要的属性和方法。

int类型的默认值为0,Integer类型的默认值为null。

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-11-07
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案