fork(4) download
  1. class Base {
  2.  
  3. static public int myVar;
  4.  
  5. static
  6. {
  7. Base.myVar = 10;
  8. System.out.println(myVar);
  9. }
  10.  
  11. }
  12.  
  13.  
  14. class Derived extends Base {
  15.  
  16. static public int myVar2;
  17. }
  18.  
  19.  
  20. public class Main {
  21. public static void main( String[] args ) throws Exception {
  22. System.out.println(Derived.myVar);
  23. System.out.println(Base.myVar);
  24. }
  25. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
10
10
10