自动装箱 和 自动拆箱 (JDK.15)

自动装箱:Integer a = 1;    ·········    Integer a = Integer.valueOf(1);    

自动拆箱:int b = a;    ·········            int b = a.intValue();

 

当用基本类型和对象做 “==” 运算时,对象会先自动拆箱为基本类型。

posted @ 2018-05-19 15:50  snoopy666  阅读(95)  评论(0)    收藏  举报