码迷,mamicode.com
首页 > 其他好文 > 详细

考试第8题

时间:2019-08-11 21:13:31      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:sys   length   next   image   pac   main   技术   util   package   

技术图片

 

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();
    }
    
}

技术图片

 

考试第8题

标签:sys   length   next   image   pac   main   技术   util   package   

原文地址:https://www.cnblogs.com/bichen-01/p/11336428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!