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();
}
}
?
輸出:
靜態區
非靜態!
構造器!!