100 账号和密码登录
package com.fqs.demo001; import java.util.Scanner; public class Compare { public static void main(String[] args) { String name="abc"; String secret="abc123"; Scanner sc=new Scanner(System.in); int count=0; while(count<3){ System.out.println("请输入名称:"); String s_name=sc.next(); System.out.println("请输入密码:"); String s_secret=sc.next(); if(s_name.equalsIgnoreCase(name)&&s_secret.equals(secret)){ System.out.println("成功登录"); //登录成功 break; } else{ System.out.println("登录失败"); } count++; } } }