1.int是基本的数据类型,直接存数值;
2.Integer是int的封装类;integer
是对象,用一个引用指向这个对象;Integer
是一个类,是int的扩展,定义了很多的转换方法。
3.int和Integer都可以表示某一个数值;
4.int和Integer不能够互用,因为他们两种不同的数据类型;
举例说明
ArrayList
al=new
ArrayList();
int
n=40;
Integer
nI=new
Integer(n);
al.add(n);//不可以
al.add(nI);//可以integer
是对象,用一个引用指