Answer the question
In order to leave comments, you need to log in
Why Object.toString(obj) != String.ValueOf(obj)?
Google writes that these methods are equivalent, except that when null ValueOf throws a NullPointerException, while toString does not.
But if you run
System.out.ptintln(Object.toString(obj) == String.ValueOf(obj))
java will print "false" to the console. Answer the question
In order to leave comments, you need to log in
Because in Java, the equality operator is not applicable for checking the equality of objects. Canonical answer to this thread.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question