public class F {
static {
System.out.println("父类的静态代码块");
}
{
System.out.println("父类非静态代码块");
}
public F() {
System.out.println("父类的构造器");
}
}
public class C extends F {
static F f = new F();
static {
System.out.println("子类的静态代码块");
}
{
System.out.println("子类非静态代码块");
}
public C() {
System.out.println("子类的构造器");
}
public static void main(String[] args) {
C c = new C();
}
}
有点晕,,,,,,, |