I have a simple piece of code to validate a username and a password.
public boolean isValid(String u, String p) {
if (u=="admin" && p=="password1") {
return true;
} else if (u=="user" && p=="password2") {
return true;
} else {
return false;
}
}
I've tried debugging it, and when it runs, u has the value "admin" and p has the value "password1", but it just skips the first condition. I must have done something wrong, but I can't figure out what.