public class CompareBigNum {
public static void main(String[] args) throws IOException {
String reg = int a,b,c;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while(true){
System.out.println("请输入要比较的数字:"+"/n"+"-->");
String input = reader.readLine();
if(input.equals("q")||input.equals("exit")){
System.exit(0);
}
if(input.matches("a,b,c")){
System.out.println("这是最大数");
}else{
System.out.println("请输入数字 ");
}
}
}
}
本文介绍了一个简单的Java程序,该程序使用BufferedReader从用户处获取输入,并比较三个数字(a, b, c)。如果输入符合特定模式'a,b,c',则输出最大数提示。否则,程序将提示用户重新输入正确的数字格式。

被折叠的 条评论
为什么被折叠?



