package cn.kgc.demo.;
import java.util.Scanner;
public class Tet3 {
public static void main(String[] args) {
//先创建 Scanner 键盘入口
Scanner input=new Scanner(System.in);
System.out.println("**欢迎进入注册系统**");
//用 while 循环 语句
while(true) {
System.out.println("请输入用户名:");
String usName=input.next();
System.out.println("请输入密码:");
String usPassword=input.next();
System.out.println("请再次输入密码:");
String newUsPassword=input.next();
//用 if去进行判断,用户名不能小于3,密码不能小于6
if(usName.length()>=3&&usPassword.length()>6) {
if(usPassword.equals(newUsPassword)) {
System.out.println("注册成功!");
break;
}else {
System.out.println("两次输入的密码不相同");
}
}
if(usName.length()<3) {
System.out.println("用户名长度不能小于3,");
}
if(usPassword.length()<=6) {
System.out.println("密码长度不能小于6");
}
}
}
}
// 输出结果,如果输入不符合条件,会报错给出提示。
**欢迎进入注册系统**
请输入用户名:
admin
请输入密码:
1234567
请再次输入密码:
1234567
注册成功
Java软件编程语言 实用类 会员注册
猜你喜欢
转载自blog.csdn.net/SuperKite/article/details/87916181
今日推荐
周排行