Reputation: 624
I have a problem with an ifstatement in a StringTokenizer method i think it is due to it being a char array, I have tryed to convert it but it seems not to work any help would be aprecheated thanks harry.
char[] password = loginPass.getPassword();
StringTokenizer st = new StringTokenizer(theText, ",");
if (thisToken.equals(password))
{
System.out.println("Hi Harry u got the pasword right!!!");
}
Upvotes: 1
Views: 1155
Reputation: 421040
Note that a char[]
will never equal a String
.
You could try
if (thisToken.equals(new String(password)))
If thisToken
actually happens to be a char[]
too, then you probably want to use Arrays.equals(thisToken, password)
to compare the content of the arrays.
Upvotes: 3