可以认为就是返回值类型不同。

static
int parseInt(String s)

         
将字符串参数作为有符号的十进制整数进行分析。


static
Integer valueOf(int i)

         
返回一个表示指定的 int 值的 Integer 实例。

static
Integer valueOf(String s)

         
返回保持指定的 String 的值的 Integer 对象。

当你调用参数为int的方法时test(Integer.parseInt(chuan))会翻译通过,但test(Integer.valueOf(chuan))会翻译错误.

new Integer.valueof().intValue();返回的也是一个int的值。

相关文章:

  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-06-11
  • 2022-12-23
  • 2021-05-25
  • 2021-09-25
  • 2022-12-23
  • 2021-08-28
相关资源
相似解决方案