Class cache = Integer.class.getDeclaredClasses()[0];Field c = cache.getDeclaredField("cache");c.setAccessible(true);Integer[] array = (Integer[]) c.get(cache);// array[129] is 1array[130] = array[129]; // Set 2 to be 1array[131] = array[129]; // Set 3 to be 1Integer a = 1;if(a == (Integer)1 && a == (Integer)2 && a == (Integer)3){ System.out.println("Success");} 另一个答案,说实话比较“牛逼”了: