package 类成员执行顺序;
public class Test {
public static void main(String[] args) {
new Son();
}
}
//父类Parent
class Parent {
{
System.out.println("Parent的初始化块");
}
static {
System.out.println("Parent的static初始化块");
}
public Parent() {
System.out.println("Parent的构造方法");
}
}
class Son extends Parent {
{
System.out.println("Son的初始化块");
}
static {
System.out.println("Son的static初始化块");
}