static块的执行顺序问题 Posted on 2019-10-08 | | 次阅读 代码如下 123456789101112131415161718192021222324252627public class Test {public static void main(String[] args) { B b=new B(); } static{ System.out.println("Test static块执行"); } public Test(){ System.out.println("Test类初始化。。。。。"); } static class A{ static{ System.out.println("A的static块执行"); } public A(){ System.out.println("A类初始化。。。。。"); } } static class B extends A{ static { System.out.println("B的static初始化"); } public B(){ System.out.println("B类初始化。。。。。"); } }} 输出如下 Donate comment here Donate WeChat Pay Alipay Bitcoin