News for hackers. Stuff that matters.
Re:My last name makes me invisible to Computers (2015) by tim333 on Saturday August 19, 2017 @07:55AM (#15052885)
Trying it in the console just now I see javascript does it too

    >"hey "+null
    "hey null"
I wonder why the language designers thought that was a good idea?
Re:My last name makes me invisible to Computers (2015) by kpil on Saturday August 19, 2017 @09:08AM (#15053144)
The reason is that the string concatenation operation is doing a String.valueOf() on the argument, and that delegates to toString() that promises a human readable string that is relevant.

For some reason someone decided to check for null instead of the stricter option of throwing a NullPointerException. Maybe to help debugging or to follow the gist of toString().

I guess it was too late to change even in Java 0.9... Autoboxing, iterators and other newer features are more strict,so I suppose it's just one of the few irregularities left from prehistoric times...