asked core java questions. If a method is overloaded in a class in the following way public void fun(Object o){ } public void fun(ArrayList a){ } and is invoked in the following manner obj.fun(null) which method will be invoked.
Sigiloso
1. Whenever there's Method Overloading, the JVM will search for the method from the most specific type to least specific type 2. In this case either of the methods can be called when passing null, since the "null type" is assignable to both Object and to ArrayList. The method that takes ArrayList is more specific so it will be picked.