Whenever more than one overloaded methods can be applied to the argument list, the most specific method is used.
In this case either of the methods can be called when passing null
, since the "null type" is assignable to both Object
and to String
. The method that takes String
is more specific so it will be picked.