public class Ex {
public static void main(String[] args) {
try {
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
int c = a/b;
// c = 0;
System.out.println(c);
}catch (ArithmeticException n) {
System.out.println("捕获一个算数异常");
throw n;
}catch (NumberFormatException n) {
System.out.println("捕获一个异常");
throw n;
}finally {
System.out.println("总是被执行");
}
}
}
2018.12.13 jav22
最新推荐文章于 2024-06-02 11:03:56 发布