int 跟 Integer 的关系

Integer是对象

Int是类型

比如 boolean 和Boolean就也不一样,long和Long等等

作为参数传递时要注意

要进行转换如下

int到Integer:
int a=3;
Integer A=new Integer(a);
或:
Integer A=Integer.valueOf(a);

Integer到int:
Integer A=new Integer(5);
int a=A.intValue();

至于Integer.parseInt(String str)则是将String类型转为int类型。
原文地址:https://www.cnblogs.com/xiaoshuaidiboke/p/7155423.html