Paul Benedict wrote:
Why would you choose to return "null" for any null object?
Because that is how the platform has always treated null in string
concatenation.

If you were defining new operations for String, StringBuilder, or
StringBuffer, I would agree with your choice. Since you are now
defining a global utility method for all objects, I think having
"null" being the de-facto string representation of null is simply
taking it too far.

System.out.println("" + referenceOfAnyType);

will print "null" if referenceOfAnyType is null.

This is what the platform has done since the beginning.

-Joe

Reply via email to