1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| public static void main(String[] args) { String okName = "a"; String okPassword = "123456";
Scanner scanner = new Scanner(System.in); System.out.println("登录名称:"); String name = scanner.next(); System.out.println("登录密码:"); String password = scanner.next();
if(okName.equals(name) && okPassword.equals(password)){ System.out.printf("登录成功"); }else{ System.out.println("登录失败"); }
String sysCode = "12Asd"; String code1 = "12asd";
System.out.println(sysCode.equals(code1)); System.out.println(sysCode.equalsIgnoreCase(code1));
}
|