Java面试问题之九
请给出下列程序的运行结果,并分析原因:
class Base{ static int a=1; static{ System.out.println("init Base"); } static void method(){ System.out.println("method of Base"); }}class Sub extends Base{ static { System.out.println("init Sub"); }}public class Sample{ public static void main(String[] args){ System.out.println("a="+Sub.a); Sub.method(); }}