Zaloguj się w Javie z 3 attpmtps
private void executeLogin() {
String userNameStr = userNameTF.getText();
String passWordStr = passWordTF.getText();
int totalAttempts = 3;
while (totalAttempts != 0) {
if (userNameStr == "temp" && passWordStr == "pass") {
System.out.println("Login Correct!");
return;
} else {
System.out.println("Incorrect Login");
totalAttempts--;
System.out.println(totalAttempts);
}
}
if (totalAttempts == 0) {
System.out.println("Maximum number of attempts exceeded");
}
}
Fernandez, Jasmine M.