Better HN
topnewbestaskshowjobs
Log inSign up

prokoba

5 karma · joined Nov 2, 2009 (17y ago) · 1 submissions

Submissions

comment 17y ago · link · parent

I've seen this in an old book (Code Complete?) a few aeons ago, and I can't say I like it, but I use it a lot.

In Java/C# this can throw a null pointer exception:

myString.equals("another string");

however this will never throw anything:

"another string".equals(myString); //false if myString is null, this is what you mean in most cases anyway