try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" Enter the Amount of articles to be ordered.");
amount = reader.readLine();
if(amount.trim().isEmpty()){
System.out.println("Amount Entered is Empty");
}
for(int count=0;count<amount.length();count++){
if(!Character.isDigit(amount.charAt(count))){
throw new NumberFormatException();
}
}
order.validateAmount(amount);
}catch(NumberFormatException numbere){
System.out.println("Either Number format is uncorrect or String is Empty, Try Again.");
}
上面的代码为空字符串异常和无效数字数据异常提供了一个 println() 语句,这是我不想要的。我想要两个异常的单独 println() 语句。怎么获得?