fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class X {
  9. int i ;
  10. X(){ i = 10; }
  11. void print() { System.out.print(i+","); }
  12. }
  13.  
  14. class Y extends X {
  15. int i = 15;
  16. int j = 10;
  17. Y(){ j = 20; }
  18. void print() { System.out.print(j+","); }
  19. void superprint() {print();}
  20. }
  21.  
  22. class Z extends Y {
  23. int k ;
  24. Z(){
  25. super();
  26. k = 30;
  27. }
  28. void print() {System.out.print(k+",");}
  29. void test(){
  30. print();
  31. super.superprint();
  32. System.out.print(super.j+",");
  33. System.out.println(i);
  34. }
  35.  
  36. public static void main(String args[]) {
  37. Z z = new Z();
  38. z.test();
  39. }
  40. }
Success #stdin #stdout 0.35s 53600KB
stdin
Standard input is empty
stdout
30,30,20,15