== operator doesn't work when comparing two Java
String objects, even if the
Strings store the same content, because the
== operator compares the two object references to each other. Since they aren't the same reference, they aren't equal.
In short, when comparing two Java
String objects, compare them like this:
// your code ...
and specifically do not compare two
String objects like this: