mpute.class);
int result = 0;
int[] num = compute.getNum();
String answer = null;
try {
System.out.println("请输入第一个数字:");
num[0] = input.nextInt();
System.out.println("请输入第二个数字:");
num[1] = input.nextInt();
result = num[0] / num[1];
System.out.println("是否保存结果?(y/n)");
answer = input.next();
if (answer.equalsIgnoreCase("y")) {
num[2] = result;// 试图将计算结果保存到数组中
}
} catch (InputMismatchException e) {
System.out.println("用户输入数据类型错误!");
log.deb
ug("用户输入数据类型错误!");
} catch (ArithmeticException ae) {
System.out.println("发生算术错误!" + ae.getMessage());
log.info("发生算术错误!" + ae.getMessage());
} catch (ArrayIndexOutOfBoundsException aee) {
System.out.println("数组发生越界!");
log.warn(aee);
} catch (Exception exception) {
System.out.println("程序发生异常,给您带来不便,请重新启动!");
log.error(exception);
} finally {
Syste