public class A {
static {
System.out.println("父类静态代码块");
}
{
System.out.println("父类非静态代码块");
}
public A() {
System.out.println("父类构造函数");
}
}
public class B extends A{
static {
System.out.println("子类静态代码块");
}
{
System.out.println("子类非静态代码块");
}
public B() {
System.out.println("子类构造函数");
}
public static void main(String[] args) {
B b = new B();
System.out.println("main方法");
}
}