java专项训练第三天

1.运行下面代码,输出的结果是?

public class Text01 {
    public static void main(String[] args) {
        System.out.println(S.abc);
    }
}

class P{
    public static int abc=123;
    static{
        System.out.println("P is init");
    }
}
class S extends P{
    static{
        System.out.println("S is init");
    }
}

想要弄清楚这道题我们需要下面的知识:
《深入理解java虚拟机》:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/c1776167012/article/details/106195991