import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
for (int i = 0; i < 3; i++) {
System.out.println("请输入用户名");
String s=sc.nextLine();
System.out.println("请输入密码");
String ss=sc.nextLine();
if("admin".equals(s)&&"passord".equals(ss)){
System.out.println("欢迎"+s+"登录");
break;
}
else if(i==2){
System.out.println("不好意思,请明天再来");
break;
}
else{
System.out.println("你还有"+(2-i)+"次机会");
}
}}
}
{:2_32:} |
|