Remember that the null literal is of type "special null type" and not of type Object
A common confusion is that the null literal is of type Object , which leads people to believe that the nearest consistent signature is target(Object val, String chk) .
The literal null is actually of type "[special null type]" ( Java Language Spec (JLS) 4 ). If such a method could be defined, the closest match would be target([special null type] val, String chk) .
However, since there is no such method (you could not create it), the compiler searches for the closest match through subtyping ( JLS 15.12. 2.2 ). The direct supertype of [special null type] is all reference types ( JLS 4.10.2 ) (for example, String), and Object is the supertype of String.
Perhaps a more intuitive way to look at this is through the intuitive definition of JLS for the “most concrete method” ( JLS 15.12.2.5 )
"An informal intuition is that one method is more specific than another if any call processed by the first method can be transferred to another without a compilation type error."
Of the two methods that the call to target(null ,"Object") answers, any call
void target(String val, String chk)
can be processed
void target(Object val, String chk)
therefore, intuitively void target(String val, String chk) is the “most specific” that could be called without a type error.
See JLS 15.12.2.5 for how “the most specific” is formally defined.