在这里插入代码片
```public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
boolean find=false;
do {
System.out.println("请输入身份证号:");
String hao=sc.next();
System.out.println("请输入手机号:");
String number=sc.next();
System.out.println("请输入座机号:");
String zuo=sc.next();
String[]pr=new String[2];
pr=zuo.split("-");
if(hao.length()!=18&&hao.length()!=16) {
System.out.println("身份证号必须是16位或18位");
}else if(number.length()!=11) {
System.out.println("手机号码必须是11位");
}
if(pr[0].length()!=4) {
System.out.println("座机密码区号必须为4位!电话号码长度必须是7位!");
}else if(pr[1].length()!=7) {
System.out.println("座机密码区号必须为4位!电话号码长度必须是7位!");
}else {
find=true;
System.out.println("注册成功");
}
}while(find==false);
}
}
2022年12月29日进行注册身份证功能
最新推荐文章于 2024-07-20 23:55:03 发布