| 13 | */ |
| 14 | public class StringTest { |
| 15 | public static void main(String[] args) { |
| 16 | // �����̶����û��������� |
| 17 | // String username = "admin"; |
| 18 | // String password = "admin"; |
| 19 | |
| 20 | for (int x = 0; x < 3; x++) { |
| 21 | // x=0,1,2 |
| 22 | |
| 23 | // ����¼���û��������� |
| 24 | Scanner sc = new Scanner(System.in); |
| 25 | System.out.println("�������û�����"); |
| 26 | String name = sc.nextLine(); |
| 27 | System.out.println("���������룺"); |
| 28 | String pwd = sc.nextLine(); |
| 29 | |
| 30 | // �Ƚ��û��������� |
| 31 | if ("admin".equals(name) && "admin".equals(pwd)) { |
| 32 | System.out.println("��¼�ɹ�"); |
| 33 | break; |
| 34 | } else { |
| 35 | if (2 - x == 0) { |
| 36 | System.out.println("�ʺű�������������ϵ"); |
| 37 | } else { |
| 38 | // 2,1,0 |
| 39 | System.out.println("��¼ʧ�ܣ��㻹��" + (2 - x) + "�λ���"); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | } |