fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. class ClassA{
  7. ClassA(){
  8. System.out.print('A');
  9. this.prn();
  10. }
  11. void prn(){
  12. System.out.print('B');
  13. }
  14. }
  15. class ClassB extends ClassA {
  16. ClassB(){
  17. super();
  18. System.out.print('D');
  19. }
  20. void prn(){
  21. System.out.print('E');
  22. }
  23. void prn(int x){
  24. System.out.print(x);
  25. }
  26. }
  27. /* Name of the class has to be "Main" only if the class is public. */
  28. class Test
  29. {
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. // your code goes here
  33. int x=7;
  34. ClassB cal= new ClassB();
  35. cal.prn(x);
  36. }
  37. }
Success #stdin #stdout 0.1s 54624KB
stdin
Standard input is empty
stdout
AED7