is there something wrong with this if statement i am trying to make a swing login system??? thanks :)
public void login()
{
String username = loginField.getText();
char[] password = loginPass.getPassword();
if (username.equals("test") && password.equals("test"))
{
System.out.println("logged in");
}
}
You might want
new String(password).equals("test")
instead. Comparing array to string makes little sense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With