模拟QQ登陆

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("账号与密码都有误!");
        }
    }
}
  • 运行结果
posted @ 2021-12-14 10:19  锅巴编程  阅读(897)  评论(0编辑  收藏  举报