装箱:将基本类型用它们对应的引用类型包装起来;
拆箱:将包装类型转换为基本数据类型;
//自动装箱
Integer total = 99; //系统自动执行了Integer total = Integer.valueOf(99);
//自定拆箱
int totalprim = total; //系统自动执行了int totalprim = total.intValue();
装箱:将基本类型用它们对应的引用类型包装起来;
拆箱:将包装类型转换为基本数据类型;
//自动装箱
Integer total = 99; //系统自动执行了Integer total = Integer.valueOf(99);
//自定拆箱
int totalprim = total; //系统自动执行了int totalprim = total.intValue();