zoukankan      html  css  js  c++  java
  • 【0708】(OOP)用户密码管理

     1 package password;
     2 
     3 import java.util.Scanner;
     4 
     5 public class Password {
     6     static Scanner sc =new Scanner(System.in);
     7     String userName="admin1";
     8     int userPassword=111111;
     9     
    10     public void showInfo() {
    11         System.out.print("请输入用户名:");
    12         String user=sc.next();
    13         System.out.print("请输入密码:");
    14         int password=sc.nextInt();
    15         if(user.equals(userName)&&password==userPassword){
    16             System.out.println();
    17             this.newPassword();
    18         }else {
    19             System.out.println("用户名和密码不匹配!您没有权限更新管理员信息。");
    20         }
    21     }
    22     
    23     private void newPassword() {
    24         System.out.print("请输入新密码:");
    25         userPassword=sc.nextInt();
    26         System.out.println("修改密码成功,您的新密码为:"+userPassword);
    27     }
    28 }
    1 package password;
    2 
    3 public class Main {
    4     public static void main(String[] args) {
    5         Password gm=new Password();
    6         gm.showInfo();
    7     }
    8 }

  • 相关阅读:
    浅谈HTTP中Get与Post的区别
    js 执行完setTimeout再接着执行函数
    2017年书单
    js判断img是否存在
    md5
    GIF播放器
    java 集合(二)
    java 泛型
    抓包工具
    js计算地球两个经纬度之间的距离
  • 原文地址:https://www.cnblogs.com/yanglanlan/p/11156376.html
Copyright © 2011-2022 走看看