Java Integer Cache Java 代码 public class IntegerDemo { public static void main(String[] args) { Integer a = new Integer(1); Integer b = 1; int c = 1; System.out.println(a == b); System.out.println(a == c); System.out.println(b == c); Integer f1 = 100,
本文版权归 远方的风lyh和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 在网上看到一个面试题,没有完全做, 本代码基于JDK8 //下面代码运行结果是 public class Test3 { public static void main(String[] args) { Integer a = 1; Integer b = 2; Integer c = 3; Integer d = 3; Integer e = 11; Integer f = 11; Long g =
先看一下下面的结果 1.System.out.println(127==127); //true , int type compare 2.System.out.println(128==128); //true , int type compare 3.System.out.println(new Integer(127) == new Integer(127)); //false, object compare 4.System.out.println(Integer.parseInt("1