package exercise;
import java.util.Scanner;
public class abnormal01 {
public static void main(String[] args) {
int sum=0;
try {
int n1=Integer.parseInt(args[0]);
int n2=Integer.parseInt(args[1]);
int b=args.length;
if(b!=2){
throw new ArrayIndexOutOfBoundsException();
}
sum=cat(n1,n2);
} catch (NumberFormatException e) {
System.out.print( "数据格式不正确 "+e.getMessage());
} catch (ArrayIndexOutOfBoundsException e){
System.out.print("缺少命令行参数 "+e.getMessage());
}catch (ArithmeticException e){
System.out.print("计算错误 "+e.getMessage());
} finally {
System.out.print(sum+" 运行结束");
}
}
public static int cat(int n1,int n2) {
return n1 / n2;
}
}