装箱:
自动将基本数据类型转换为包装器类型。
拆箱:
将自动包装器类型转换为基本数据类型。
基本类型:
public class Test{
public static void main(String[] args){
//自动装箱
Integer total = 50;
//自动拆箱
int totalprint = total;
}
}
Integer total = 50;实际上执行了:Integer total = Integer.valueOf(50);
int totalprint = total;实际上执行了:int totalprint = total.intValue();