赞
踩
假如有一天,你要找工作,等到了面试邀请,来到了面试公司,做完了笔试题,迎来了面试官。
面试官的第一个问题确是:你如何用一段代码证明在JVM加载类是懒加载模式?
来来来,都坐下,先看看这段代码,思考一下结果。
- public class SuperClass {
-
- static {
- System.out.println("SuperClass init");
- }
- public static int value = 10;
- }
-
- class SubClass extends SuperClass {
- static {
- System.out.println("SubClass init");
- }
- }
-
- class TestClass {
- public static void main(String[] args) {
- System.out.println(SubClass.v

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。