51,407
社区成员
发帖
与我相关
我的任务
分享
public class FirstApp {
public static int i = new Random().nextInt(101);
public static void main(String[] args) {
while (true) {
String StrAge = javax.swing.JOptionPane.showInputDialog("输入客户年龄");
int age = Integer.parseInt(StrAge);
if (age < i) {
System.out.println("小了");
} else if (age > i) {
System.out.println("大了");
} else {
System.out.println("猜中");
break;
}
}
}
}