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 }

  • 相关阅读:
    各种有趣言论收集
    人类未来进化方向恶考
    mysql 列所有表行数
    恩,有那么一个人
    00后厉害哇
    。。。。
    放弃微博,继续回来写月经
    嘿,大家还好吗
    git
    require js
  • 原文地址:https://www.cnblogs.com/yanglanlan/p/11156376.html
Copyright © 2011-2022 走看看