Shuzheng
12/7/2019 - 4:54 AM

自动装箱与拆箱

int num2= 0
//若没用自动装箱
Integer int1 = new Integer(num2);
//自动装箱, 不需要再new了
Integer int1 = num2;

//若没用自动拆箱
int num3 = int1.intValue();
//自动拆箱
int num3 = int1;

//String类型---> 基本数据类型
String str1 = "123";
int num2 = Integer.parseInt(str);