自动装箱 和 自动拆箱 (JDK.15)
自动装箱:Integer a = 1; ········· Integer a = Integer.valueOf(1);
自动拆箱:int b = a; ········· int b = a.intValue();
当用基本类型和对象做 “==” 运算时,对象会先自动拆箱为基本类型。
自动装箱:Integer a = 1; ········· Integer a = Integer.valueOf(1);
自动拆箱:int b = a; ········· int b = a.intValue();
当用基本类型和对象做 “==” 运算时,对象会先自动拆箱为基本类型。