package com.hnsw.Tesr02; import java.util.Scanner; public class BreakExwecise01 { public static void main(String[] args) { String sex = ""; String name = ""; Scanner in = new Scanner(System.in); for (int i = 2;i >= 0;i--){ System.out.println("请输入用户名"); sex = in.next(); System.out.println("请输入密码!"); name =in.next(); if ("丁真".equals(sex) && "666".equals(name)){ break; }else System.out.println("还有" + i + "次"); } } }
12-23
6935