In first case,
null
is a subtype of every other reference type.
So, compiler finds ambiguity in deciding which method to call..
In second case, it finds more specific object for null
which happens to be String. Hence it calls method1
and prints String Version