A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

package com.heima;

import java.util.Scanner;

public class test_online {

        public static void main(String[] args) {
                        for(int x=1;x<=3;x++){
                  Scanner  sc =new Scanner(System.in );
                        System.out.println("请输入登陆账号:");
                        String account = sc.nextLine();
                        System.out.println("请输入密码:");
                        String password = sc.nextLine();    //nextLine是输入字符的,nextxxx  后面加什么可以输入什么样的类型.
                       
                        if ("admin".equals(account )&&"admin".equals(password  )){
                                System.out.println("欢迎回来!");
                        } else if  (x<=2){
                                                        System.out.println("输入密码有误,请重新输入,还有"+(3-x)+"次机会");
                                }else {
                                        System.out.println("输入密码或用户名有误,已锁卡!");
                                }
                               
                       
                        }
                       
        }

}

2 个回复

倒序浏览
666666666666
回复 使用道具 举报

哈哈哈哈...
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马