fork(1) download
  1. class Base {
  2. public static void foo() {
  3. System.out.println("Base.foo");
  4. }
  5. }
  6. class Derived extends Base {
  7. public static void foo() {
  8. System.out.println("Derived.foo");
  9. }
  10.  
  11. public static void main(String[] args) {
  12. Base b = new Derived();
  13. b.foo(); // "Base.foo", not "Derived.foo"
  14. }
  15. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
Base.foo