Java String.equals versus ==
http://stackoverflow.com/questions/767372/java-string-equals-versus Use the String.equals(String other) function to compare strings, not the == operator. The function checks the actual contents of the string, the == operator checks whether the references to the objects are equal.