Although both methods are applicable to your situation (both can accept null as a parameter), the most specific method will be called, or in other words, the method that is "closer" to the argument that you specify. Since a parameter in printValue(String ob) can be passed to printValue(Object ob) also, but not vice versa, then the printValue(String ob) is more specific and that is why it is called. The same rule applies to primitives too. For instance, check the following code:
The most specific method is called depending on the arguments.