
package test8;
import java.util.Scanner;
public class Test {
static Scanner sc = new Scanner(System.in);
public void zc() {
while(true) {
System.out.println("请输入用户名:");
String name = sc.next();
System.out.println("请输入密码:");
String password = sc.next();
if(name.length()<3||password.length()<6) {
System.out.println("用户名的长度不能小于3,密码长度不能小于6!");
}else {
System.out.println("请再次输入密码:");
String password2 = sc.next();
if(password2.equalsIgnoreCase(password)) {
System.out.println("注册成功! 请牢记用户名和密码。");
return;
}
}
}
}
public static void main(String[] args) {
System.out.println("****欢迎进入注册系统****");
Test t = new Test();
t.zc();
}
}
