String is an object, so checking equality with == or != is checking whether they are the same reference, which may or many not be the case for identical strings. You should always use the equals (or...