Hey the above was a cool way of sorting things out.
Here is what i did
class A{}
class B extends A{}
class C extends B{}
public class overloaded
{
static public void ovMe(A a,A b){}
static public void ovMe(A a,B b){}
static public void ovMe(A a,C b){}
static public void ovMe(B a,B b){}
static public void ovMe(B a,C b){}
static public void ovMe(C a,B b){}
static public void ovMe(C a,A b){}
public static void main(String...S)
{
ovMe(new C(),new C());
}
}
In accordance with above explainations i always knew this was asking for trouble.But just couldnt understand the way compiler slapped:
overloaded.java:16 reference to ovMe is ambigous,both method ovMe(A,C) in overloaded and ovMe(C,B) in overloaded match.
Why did the compiler chose these two methods finally before throwing the error?