なぜこれは6文字以上の長さを入力しても永遠に繰り返すのですか?Javaパスワードプログラムのループは永遠に助けてください
import java.util.Scanner;
class Password {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Welcome please enter your username and password.");
System.out.print("Username >>");
input.nextLine();
enterPassword();
System.out.println("Successfully Logged In");
}
public static void enterPassword(){
String password;
Scanner input = new Scanner(System.in);
System.out.print("Password >>");
password = input.nextLine();
checkPasswordLength(password);
}
public static void checkPasswordLength(String password){
int length;
length = password.length();
while (length <6){
enterPassword();
}
checkPasswordLetter(password);
}
public static void checkPasswordLetter(String password){
System.out.println("More checking here to be added");
}
}
あなたが何かのようにユーザー名を格納していませんか? –