public class QQLogin {
public static void main(String[] args) {
int id1 = 123456;
String pwd1 = "zhangsan123";
Scanner scanner = new Scanner(System.in);
System.out.println("请输入账号");
int id = scanner.nextInt();
System.out.println("请输入密码");
String pwd = scanner.next();
if (id == id1 && pwd.equals(pwd1)) {
System.out.println("登录成功!");
} else if (id != id1 && pwd.equals(pwd1)) {
System.out.println("账号信息有误!");
} else if (id == id1 && !(pwd.equals(pwd1))) {
System.out.println("密码信息有误!");
} else {
System.out.println("账号与密码都有误!");
}
}
}
- 运行结果