Java Puzzle – Method Overloading
Program - public class OverloadingPuzzle { public void display(Object obj){ System.out.println("Object version"); } public void display(String str){ System.out.println("String Version"); } public static void main(String[] args){ OverloadingPuzzle obj = new OverloadingPuzzle(); obj.display(null); } } I was expecting that this program prints “ Object Version ” but …. Output String Version Why ? – Searching ….