当多个类之间有继承关系时,创建子类对象会导致父类初始化块的执行。
package t2;class Fu{ int a; { a=5; }}class Zi extends Fu{ public void getA() { System.out.println(a); }}public class t2 {
public static void main(String[] args) { Zi x=new Zi(); x.getA(); }
}