Integer.valueof Integer.parseOf

来源:互联网 发布:知乎回答问题如何匿名 编辑:程序博客网 时间:2024/05/22 17:42

从java api上可以看到。两者的区别。

static intparseInt(String s, int radix) 
          Parses the string argument as a signed integer in the radix specified by the second argument.


static IntegervalueOf(String s) 
          Returns an Integer object holding the value of the specified String.




即,valueof输出的是一个Integer对象。而parseInt输出的是一个int数。


原创粉丝点击