深入jvm虚拟机看到语法糖-自动拆装箱章节的有趣问题

2017-08-14  本文已影响0人  炫迈哥
public class Test {

   public static void main(String[] args){
        Integer a = 1;
        Integer b = 3;
        Integer c = 4;
        Integer d = 1;
        int i = 278;
       
        Integer e = 278;
        Integer f = 278;
        Long g = 4;

        System.out.println(c == a+b);
        System.out.println(a == d);
        System.out.println(c > a + d);
        System.out.println(g == a+b);
        System.out.println(e == f);
        System.out.println(e == i);
        System.out.println(g==d);
   }
} 

输出结果

true
true
true
true
false
true
true

解析

上一篇 下一篇

猜你喜欢

热点阅读