import java.util.Scanner; public class A03 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); for (int i = 0; i < 3; i++) { System.out.println("请输入用户名:"); String admin = input.next(); System.out.println("请输入密码:"); String pwd = input.next(); if (!admin.equals("admin") || !pwd.equals("yanyan")) { System.out.println("输入错误!您还有" + (i - 2) * -1 + "次机会"); continue; } System.out.println("欢迎登录MyShopPing系统"); return; } } }
java-第六章-for-验证用户登录信息,布布扣,bubuko.com
时间: 2024-10-06 13:41:47