import java.util.Scanner;
class Test26
{
public static void main(String[] args)
{
int count=3;
String user="heima";
String passWord="heima";
System.out.println("欢迎您使用XXXX工具");
System.out.println("请登录用户名:");
while(count>0)
{
Scanner sc=new Scanner(System.in);
String line=sc.nextLine();
System.out.println("请登录密码:");
Scanner sc1=new Scanner(System.in);
String line2=sc.nextLine();
--count;
if(user.equals(line)&&passWord.equals(line2))
{
System.out.println("欢迎您进入游戏界面");
break;
}
else
{
if(count>0)
{
System.out.println("您还有"+count+"机会");
continue;
}
else
System.out.println("您的密码有误,已被锁定");
}
}
}
}
|
|