//第十五章 上机练习1
import java.util.Scanner;
public class ASD {
public boolean verify(String name,String pwd1,String pwd2){
boolean flag=false;
if(name.length()<3||pwd1.length()<6){
System.out.println("用户名长度不能小于3,密码长度不能不能小于6");
}else if(!pwd1.equals(pwd2)){
System.out.println("两次输入的密码不相同!");
}else{
System.out.println("注册成功");
flag=true;
}
return flag;
}
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
ASD r=new ASD();
String name,pwd1,pwd2;
boolean resp=false;
System.out.println("***欢迎进入注册系统***");
do{
System.out.println("请输入用户名:");
name=input.next();
System.out.println("请输入密码:");
pwd1=input.next();
System.out.println("请再次输入密码:");
pwd2=input.next();
resp=r.verify(name, pwd1, pwd2);
}while(!resp);
}
}
第十五章上机练习1
最新推荐文章于 2019-08-06 00:11:29 发布