JAVA语法——验证登录信息的合法性

package 验证登录信息的合法性;

import java.util.Scanner;

public class 验证登录信息的合法性 {
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        
        System.out.println("请输入登录用户名");
        String username = scan.nextLine();
        
        System.out.println("请输入登录密码");
        String password = scan.nextLine();    
        
        if(! username.equals("mr"))
            System.out.println("用户名非法");
        else if(! password.equals("mrsoft"))
            System.out.println("登录密码错误");
        else
            System.out.println("恭喜你,登录信息通过验证");
    }
}

猜你喜欢

转载自www.cnblogs.com/JAYPARK/p/10111620.html
今日推荐