大致有几个
class A{
public A(){
System.out.println("A construct");
}
{
System.out.println("just A piece");
}
static{
System.out.println("A static");
}
}
static 模块
初始化块,就是一个大括号圈住
构造器
A static
just A piece
A constructA a;//执行static模块
a=new A();
static 在声明就会执行
另外是构造对象才会执行