Don't use the "==" operator to compare strings for equality. Use the
equals() method instead.
The == operator will tell you whether two references refer to the same object in memory. The
String.equals() method tells you whether one
string is the same as another.
When you use
.trim() on a String, you're practically guaranteeing that a different String object is created so the == operator will most likely result in
false. Bottom line is use
equals() when comparing objects with one another for logical equivalence.