public class IT {
public static void main(String[] args) throws Exception {
Class<?> clazz = Class.forName("java.lang.Integer$IntegerCache");
Field &eld = clazz.getDeclaredField("cache");
&eld.setAccessible(true);
Integer[] cache = (Integer[]) &eld.get(clazz);
for (int i = 0; i < cache.length; i++) {
cache[i] = new Integer(new Random().nextInt(cache.length));
}
for (int i = 0; i < 10; i++) {
System.out.println(i);
}
for (int i = 0; i < 10; i++) {
System.out.println((Integer)i);
}
}
}
2. 小问题, 输出结果是什么呢??
评论0
最新资源