public class B{
public static B t1 = new B();
public static B t2 = new B();
{
System.out.println("构造块");
}
static{
System.out.println("静态块");
}
public static void main(String[] args){
B t = new B();
}
}
初始化顺序:静态域(包括静态变量和静态块,谁在前谁先执行)-->构造块-->构造方法
构造块
构造块
静态块
构造块