fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6.  
  7. static class Foo {
  8. public void foo(String foo) { System.out.println("Foo says: Hello "+foo); }
  9. }
  10.  
  11. static class Bar extends Foo {
  12. @Override
  13. public void foo(String foo) { this.foo((Object)foo); }
  14. public void foo(Object foo) { System.out.println("Bar says: Hello "+foo); }
  15. }
  16.  
  17. public static void main (String[] args) throws java.lang.Exception {
  18. Foo f = new Bar();
  19. f.foo("world");
  20. }
  21. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Bar says: Hello world