zoukankan      html  css  js  c++  java
  • java 设置一个管理员类,修改用户密码

    先创建一个管理员类

    public class Administrator {
        String name;
        String password;// 密码
    
        public void show() {
            System.out.println("姓名" + name + "密码" + password);
        }
    
    }

    主函数

    import java.util.Scanner;
    public class ChangePassword {
        public static void main(String []args){
            String nameInput;
            String Pwd;
            String pwdConfirm;
            Scanner input=new Scanner(System.in);
            Administrator admin=new Administrator();
            admin.name="admin1";
            admin.password="123456";
            System.out.println("Please enter your name :
    ");
            nameInput=input.next();
            System.out.println("Please enter your password:
    ");
            Pwd=input.next();
            if(admin.name.equals(nameInput)&&admin.password.equals(Pwd)){
                System.out.println("Please enter new Pwd:
    ");
                Pwd=input.next();
                System.out.println("Please enter new Pwd again:
    ");
                pwdConfirm=input.next();
                while(!Pwd.equals(pwdConfirm))
                {
                    System.out.println("Please enter new Pwd again:
    ");
                    System.out.println("Please enter new Pwd:
    ");
                    Pwd=input.next();
                    System.out.println("Please enter new Pwd again:
    ");
                    pwdConfirm=input.next();
                }
                System.out.println("SUCCESS, your new pwd is "+Pwd);
            System.out.println("用户名:"+admin.name+"密码:"+Pwd);
           
            
            }
            else{
                System.out.println("the usename is not match the pwd:
    ");
                
                
            }
            
        }
        
    }
  • 相关阅读:
    docker部署Nginx
    docker的常用命令
    centos上安装docker
    springcloud负载均衡及Ribbon
    maven下载私服jar
    spring security异常处理的三种方式
    spring security权限控制
    北京理工大学复试上机--2001A
    北京理工大学复试上机--2000
    PAT1067 试密码 (20分)——测试点4分析 一个易错点
  • 原文地址:https://www.cnblogs.com/Angella/p/6721400.html
Copyright © 2011-2022 走看看