method(b); // which method? method(base) or method(derived)?
} public static void main(String args[]) { Base b = new Base(); Derived d = new Derived(); System.out.println(“test calls.”); test(b); test(d); } } Running the program gives an output of test calls. Base: In the base method… Derived: In the base method… See JLS section 15.11.4.4 and 15.11.3: “If class S contains a declaration for a method named m with the same descriptor (same number of parameters, the same parameter types, and the same return type) required by the method invocation as determined at compile time then this is the method to be invoked.” 7. (Sect.