The first invocation is to String#valueOf(Object)
, the second is to String#valueOf(char[])
The overloaded method is chosen according to the argument's static type, this is why the first works and the seconds get an NPE.
If you invoke System.out.println ( String.valueOf((Object)null));
it will work