fork download
  1. import java.util.ArrayList;
  2. import java.util.List;
  3.  
  4. class A
  5. {
  6. public final static List<Integer> list;
  7. static
  8. {
  9. System.out.println("Loaded Class A");
  10. list = new ArrayList<>();
  11. }
  12. }
  13.  
  14. class B
  15. {
  16. public final static int dependsOnA;
  17. static
  18. {
  19. System.out.println("Loaded Class B");
  20. dependsOnA = A.list.size();
  21. }
  22. }
  23.  
  24. class C
  25. {
  26. static
  27. {
  28. System.out.println("Loaded Class C");
  29. }
  30.  
  31. public static void main(String[] args)
  32. {
  33. System.out.println(B.dependsOnA);
  34. }
  35. }
Success #stdin #stdout 0.09s 321344KB
stdin
Standard input is empty
stdout
Loaded Class C
Loaded Class B
Loaded Class A
0