why the outpout is false??
y1 will use the method f from B .because B is the son of A and they both have f
further more the father doesnt have a method f wich recieves B type variable
and they are equla
Since you are calling a OVERLOADED method, compiler will look for the reference type only and not the instance type.
You are invoking the method f using class A's reference variable. And A knows only f(A a). At runtime you can pass a covariant i.e, you can pass B's instance to f(A a).
y1.f(y2) will invoke A's f(A,a) method. Hence you are getting false obviously.