Public classLogin { Public Static voidMain (string[] args) {System.out.println (* * * Welcome to the registration system ******); BooleanFalg =false; Do{System.out.println ("Please enter user name:"); Scanner input=NewScanner (system.in); String name=Input.next (); //If the user name length is greater than or equal to 3 if(Name.length () >= 3) {Falg=false; System.out.println ("Please enter your password:"); //Enter the password for the first timeString PSW1 =Input.next (); System.out.println ("Please enter your password again"); //re-enter the password, PSW1 and PSW2 compare the sameString PSW2 =Input.next (); //If the first input password length is greater than or equal to 6 digits and the first time the password and the second time the same if(Psw1.length () >= 6 &&psw1.equals (PSW2)) {Falg=false; System.out.println ("Registration is successful!" "); //If the first input password length is greater than or equal to 6 digits and the first time the password and the second time is different}Else if(Psw1.length () >= 6 &&!PSW1. equals (PSW2)) {Falg=true; System.out.println ("Registration failed, two password input is not the same"); //the above conditions are not satisfied, indicating that the password length is less than 6 digits}Else{falg=true; System.out.println ("Password length must not be less than 6 digits"); } } Else{falg=true; System.out.println ("User name length cannot be less than 3 digits"); } } while(FALG); }}
Java easy to register membership system