== operator doesn't match strings correctly!
One of hundreds of answers available with our premium content service.
A: Java strings are stored as an immutable sequence of Unicode characters and the class' equals() method is overridden to compare that character content, so standard logical comparison operators will not give the result one might expect. If you use the simple comparison operator on two string objects that represent the same string, it will return false. Always use the equals(Object) method to compare the contents of two strings, as below.
… full answer hidden
Premium members click below for full answer
The == operator doesn't match strings correctly!