public 类的父类在同个文件,在加载的时候为何看起来还没访问就调用了父类的静态块,求拍砖package testpub
public 类的父类在同个文件,在加载的时候为何看起来还没访问就调用了父类的静态块,求拍砖
package test;
public class InitialzationSequence extends Super { int i = 2; static { System.out.println("2.static block!"); }
Common common = new Common(); { System.out.println("9.sub common block!"); } public InitialzationSequence() { System.out.println("10.sub constructor!"); } public static void main(String[] args) { System.out.println("4.normal action"); InitialzationSequence is = new InitialzationSequence();