Question: Hi, please help me with this Java project. I need it to be in the loop until the user enter valid password. Thanks public static
Hi, please help me with this Java project. I need it to be in the loop until the user enter valid password. Thanks
public static void main(String[] args) { //To hold the user's input String a, b; //A Scanner object for keyboard input. Scanner a1 = new Scanner(System.in); //Prompt the user to enter the password. System.out.print(" Please enter your password: "); a = a1.next(); // Reading password again System.out.print(" Please re-enter your password: "); b=a1.next(); // If both strings are equal if(a.equals(b)) { // Validating for length if(a.length() >= 6 && a.length() <= 10) { boolean letters = false, numbers = false, specials = false; String specialChars = "*#$"; // Iterating over string for(int i=0; i } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
