Why doAction(A a)
will be selected in this situation?
Can you advice some articles to read about method selection depending on argument type?
class A { }
class B extends A { }
class D {
void start(A a){
doAction(a);
}
void doAction(A a) {
System.out.println("A action");
}
void doAction(B b) {
System.out.println("B action");
}
}
public class Test {
public static void main(String[] args) {
new D().start(new B());
}
}