一个奇葩题目

群里面看到的一个奇葩题目与三个所谓答案如下:

其中针对第二种解决方案写个测试代码

Class cache = Integer.class.getDeclaredClasses()[0];
       Field myChache = cache.getDeclaredField("cache");
       myChache.setAccessible(true);
       Integer[] newCache = (Integer[]) myChache.get(cache);   
       newCache[128] = 100;
       Integer a = 0;
       System.out.println(a); //100

 

 

 

 

 

猜你喜欢

转载自xiaoxiaoher.iteye.com/blog/2356538