You need to use the equals() method to compare the contents of two Strings, not the == operator.