![在这里插入图public class ChangeMassage {
String name;
String password;
public static void main(String[] args){
ChangeMassage cm = new ChangeMassage() ;
cm.name = "manger";
cm.password = "0000";
Scanner input = new Scanner(System.in) ;
System.out.print("请输入旧用户名:");
String n = input.next() ;
System.out.print("\n请输入旧密码:");
String p = input.next() ;
if(n.equalsIgnoreCase(cm.name ) && p.equalsIgnoreCase(cm.password ) ) {
System.out.print("请输入新用户名:");
String rn = input.next() ;
System.out.print("\n请输入新密码:");
String rp = input.next() ;
System.out.println("\n用户名:"+rn+"\n密码:"+rp);
} else if(!n.equalsIgnoreCase(cm.name ) && p.equalsIgnoreCase(cm.password ) ){
System.out.println("用户名不正确!无权修改!");
} else if(n.equalsIgnoreCase(cm.name ) && !p.equalsIgnoreCase(cm.password ) ){
System.out.println("密码不正确!无权修改!");
}
}
}
片描述](https://img-blog.csdnimg.cn/20200303224740271.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L015Y29kZTEyMzQ=,size_16,color_FFFFFF,t_70)