fork download
  1. public class Main {
  2.  
  3. static class A {
  4. static {
  5. System.out.println("A static block");
  6. }
  7. }
  8.  
  9. static class B {
  10. static A a;
  11. static {
  12. System.out.println("B static block start");
  13. a = new A();
  14. System.out.println("B static block finish");
  15. }
  16. }
  17.  
  18. public static void main(String[] args) {
  19. new B();
  20. }
  21. }
Success #stdin #stdout 0.06s 380160KB
stdin
Standard input is empty
stdout
B static block start
A static block
B static block finish