java 静态初始化与继承
2022-09-03 01:15:33
public class Main {
public static void main(String[] args) {
System.out.println(B.x);
}
}
class A {
public static String x = "x";
}
class B extends A {
static {
System.out.print("Inside B.");
}
}
问:为什么输出将是:.但不是:x
Inside B.x