Stupid equality test -my most common Java bug.
Devin Olson December 10 2012 04:01:59 PM
I was first introduced to Java (as a Programming Language) around 1997 or 1998, and I've been working with it on a semi-regular basis since around 2001.Since July of this year I have been working with it on a daily basis.
But even with being "elbow deep" in the language all this time, I continue to make this simple, stupid mistake.
So I'm posting it here hoping that it will help me remember, and perhaps help others as well.
(myString == anotherString)
IS NOT EQUIVALENT to
(myString.equals(anotherString))
Sigh.
-Devin.
- Comments [0]