package Devise;
public class Test {
public static void main(String[] args) {
try {
if(args.length!=2){
throw new ArrayStoreException("参数个数不对");
}
//将接收的参数转化为整数
int a=Integer.parseInt(args[0]);
int b=Integer.parseInt(args[1]);
double res=cal(a,b);
} catch (NumberFormatException e){
System.out.println("参数格式不正确,需要输入整数");
}catch (ArithmeticException e){
System.out.println("被除数不能为0");
}
}
public static double cal(int a,int b){
return a/b;
}
}



