How do I compare strings in Java? - Stack Overflow
==tests object references, .equals() tests the string values. Sometimes it looks as if == compares values, because Java does some behind-the-scenes stuff to make sure identical in-line strings are actually the same object. For example: String fooString1 =...