In other words, what are the precise rules for how the Java compiler determines which overloaded method to choose to execute? I've spent a good amount of time googling and I think I'm not using the right search keywords.
public class C1 extends C2 {}
public class C2 extends C3 {}
public class C3 {}
public class Test {
public static void main(String[] args) {
C1 c1 = new C1();
// What are the precise rules for determining
// which method below is called?
method(c1, c1);
}
static public void method(C3 test, C3 test2) {
System.out.println("C3");
}
static public void method(C2 test, C3 test2) {
System.out.println("C2");
}
}