Hi,
In the below code snipped, why is "Sub" printed. Why not "Super". How is this resolved?
01. class Super { }
02. class Sub extends Super { }
03.
04. public class
Test {
05. public void foo(Super sup) {
06. System.out.println("Super");
07. }
08.
09. public void foo(Sub sub) {
10. System.out.println("Sub");
11. }
12.
13. public static void main(
String[] args) {
14. new Test().foo(null);
15. }
16. }