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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Ride.main(args);
  13. }
  14.  
  15. }
  16.  
  17. class AAA
  18. {
  19. public void rideMethod(){System.out.println("AAA's Method");}
  20. public void loadMethod(){System.out.println("void Method");};
  21. }
  22. class BBB extends AAA
  23. {
  24. public void rideMethod(){System.out.println("BBB's Method");}
  25. public void loadMethod(int num){System.out.println("int Method");};
  26. }
  27. class CCC extends BBB
  28. {
  29. public void rideMethod(){System.out.println("CCC's Method");}
  30. public void loadMethod(double num){System.out.println("double Method");}
  31. }
  32.  
  33. class Ride
  34. {
  35. public static void main(String[] args)
  36. {
  37. AAA ref1 = new CCC();
  38. BBB ref2 = new CCC();
  39. CCC ref3 = new CCC();
  40.  
  41. ref1.rideMethod();
  42. ref2.rideMethod();
  43. ref3.rideMethod();
  44.  
  45.  
  46. ref3.loadMethod();
  47. ref3.loadMethod(1);
  48. ref3.loadMethod(1.2);
  49. }
  50. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
CCC's Method
CCC's Method
CCC's Method
void Method
int Method
double Method