MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / main

Method main

day12/code/day12_String/src/cn/itcast_03/StringTest.java:15–43  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

13 */
14public 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}

Callers

nothing calls this directly

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected