Java的装箱和拆箱
1 装箱和拆箱
装箱将基本数据类型,变成包装类
拆箱把对应的包装类转化为基本数据类型
2 自动拆箱和自动封箱
public class Main {
public static void main(String[] args) {
//自动装箱
Integer total = 99;
//自定拆箱
int totalprim = total;
}
}
自动的过程
Integer total = 99;
执行上面那句代码的时候,系统为我们执行了:
Inte
原创
2020-06-20 09:27:53 ·
156 阅读 ·
0 评论