import java.util.Scanner;
public class DiGui {
public static void main(String[] args) {
Digui();
}
private static void Digui() {
boolean b=true;
Scanner sc = new Scanner(System.in);
System.out.print("请输入要判断的数字:");
int i = sc.nextInt();
if(i==5){
b=false;
}
if(b){
System.out.println("你输入的数不是5,重新输入!");
//自己调自己
Digui();
}else{
System.out.println("输入正确,程序退出!");
}
}
}
|
|