fork(1) 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.  
  9. class X{
  10. X(){
  11. val = 1;
  12. }
  13. X(int n){
  14. val = n;
  15. }
  16. int val;
  17. }
  18.  
  19. class Y extends X{
  20. Y(int n){
  21. super(n);
  22. val -= 5;
  23. }
  24. public void print(){
  25. System.out.println(val);
  26. }
  27. }
  28.  
  29. class Sample{
  30. public static void main(String[] args){
  31. Y y = new Y(10);
  32. y.print();
  33. }
  34. }
Success #stdin #stdout 0.06s 32292KB
stdin
Standard input is empty
stdout
5