包装类
将int, float, double 等基本数据类型封装成一个对象
基本数据类型
对应的包装类
byte
Byte
short
Short
int
Integer
long
Long
float
Float
double
Double
char
Character
boolean
Boolean
装箱
将基本数据类型转换成包装类
自动装箱
int t1 = 2;
Integer t2 = t1;
手动装箱
Integer t3 = new Integer(t1);
拆箱
自动拆箱
int t4 = t2;
手动拆箱
int t5 = t2.intValue();
double t6 = t2.doubleValue();
Last updated