You're not comparing the guess and the password correctly. To compare object contents you should use the equals(..) method, not the == or != operator. The operators compare object identity, i.e....