Hi everyone,
I cannot figure it out why it is printing "Sub" in the Output even we are a passing a "null" parameter to foo()method in the below given code:
class Super{}
class Sub extends Super{
}
public class Test{
public void foo(Sub sub){
System.out.println("Sub");
}
public void foo(Super sup)
{
System.out.println("Super");
}
public static void main(
String args[]){
new
Test().foo(null);
}
}