public class Test {
static{
System.out.println("静态区");
}
{
System.out.println("非静态!");
}
private int i;
public Test(int i) {
super();
this.i = i;
}
public Test() {
System.out.println("构造器!!");
}
public static void main(String[] args) {
new Test();
}
}
输出:
静态区
非静态!
构造器!!
时间: 2024-10-05 07:09:21