I would need to find if the user input for password contains only 1 digit and I am having trouble what the if statement would be.
I currently only have:
import java.util.Scanner;
public static boolean onlyOneDigit (String password) {
if ( ........ ) {
System.out.print("Password requirement not met");
return true;
} else {
return false;
}
}
public static void main(String[] args) {
do {
System.out.print("Enter a password");
String password = input.next();
} while (onlyOneDigit(password));
{
System.out.print("Password updated");
}
}
Aucun commentaire:
Enregistrer un commentaire