java基本数据类型和包装类之间的转换(装箱,拆箱)

1、装箱:把基本数据类型转换成包装类

1.1自动装箱

int t1=2;
Integer t2 =t1;

1.2手动装箱

Integer t3 = new Integer(t1);

2、拆箱:把包装类转换成基本数据类型

2.1自动拆箱

int t4=t2;

2.2手动拆箱

int t5 = t2.intValue();
原文地址:https://www.cnblogs.com/zhangguangxiang/p/14232593.html