对象的初始化进程

对象的初始化过程
class Fu{
	int num=9;
	{
		System.out.println("Fu");
	}
	Fu(){
		super();//默认存在
		show();//子类方法覆盖父类方法
	}
	void show (){
		System.out.println("fu show    "+num);
	}
}
class Zi extends Fu{
	int num=8;//第二步显示初始化
	{//第三步 构造代码块初始化
		System.out.println("Zi");
	}
	Zi(){
		super();//第一步 调用父类构造函数
		show();//第四步 调用show方法
	}
	void show(){
		System.out.println("zi show    "+num);
	}
}
class Demo{
	public static void main(String [] args){
		Zi z=new Zi();
	}
}



输出结果为


Fu
zi  show0
Zi
zi  show8