现在的位置: 首页 > 综合 > 正文

JVM加载机制你知多少,是否真的知道,来猜猜这题的答案你就知道了。

2013年11月26日 ⁄ 综合 ⁄ 共 816字 ⁄ 字号 评论关闭

题:JVM加载机制你知多少,是否真的知道,来猜猜这题的答案你就知道了。


不要太相信自己哦,猜完之后自己测试下(也可以回复博客让我来揭晓答案),大家给下第一映像的答案,顺便调查下。

================================================大胆给出你的答案==================================================

public class Test3_JVM {

    static Test3_JVM test = new Test3_JVM();
    static int a = 0;
    public Test3_JVM(){
        a ++;
        System.out.println(a + ":constructor");
    }
    public static void show(){
        System.out.println(a + ":show");
    }
    public static void main(String[] args) {
        Test3_JVM.show();
        new Test3_JVM();
        new Test3_JVM();
        System.out.println(Test3_JVM.a);
        System.out.println(Test3_JVM.a);
        Test3_JVM.show();
    }

}

================================================大胆给出你的答案==============================================

答案:稍微加密下,省的你偷懒,选中下就可以看到答案。手机用户可以回复等我给你答案。

1:constructor
0:show
1:constructor
2:constructor
2
2
2:show

抱歉!评论已关闭.