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. public class Main {
  8. public static void main(String args[])
  9. {
  10. A.foo(); // foo from A
  11. A.bar(); // foo from A
  12. B.foo(); // foo from B
  13. B.bar(); // foo from A <- ???
  14. }
  15. }
  16.  
  17. class A
  18. {
  19. public static void foo() {
  20. System.out.println("foo from A");
  21. }
  22.  
  23. public static void bar() {
  24. foo();
  25. }
  26. }
  27.  
  28. class B extends A
  29. {
  30. public static void foo() {
  31. System.out.println("foo from B");
  32. }
  33. }
  34.  
Success #stdin #stdout 0.08s 381184KB
stdin
Standard input is empty
stdout
foo from A
foo from A
foo from B
foo from A