标签:win pac 更新 username == 技术 nbsp mamicode style
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 }
标签:win pac 更新 username == 技术 nbsp mamicode style
原文地址:https://www.cnblogs.com/yanglanlan/p/11156376.html