class Demo_1 {
public static void main(String[] args){
new Zi();
}
}
class Fu {
static{
System.out.println("Fu构造构造代码块"); //1
}
int x = 10;
{
System.out.println("Fu构造构造代码块"+x); //3 x =10;
}
public Fu(){
System.out.println("Fu构造函数"+x); //4 x =10
}
}
class Zi extends Fu {
static{
System.out.println("Zi构造构造代码块"); //2
}
int x =5;
{
System.out.println("Zi构造构造代码块"+x); //5 x =5
}
public Zi(){
System.out.println("Zi构造函数"+x); //6 x =5
}
} |
|