public class MultiCatch {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
int a =args.length;
System.out.println(a);
int b=2321/a;
int c[]={1};
c[42]=44;
}catch(ArithmeticException e){
System.out.println(e);}
catch(ArrayIndexOutOfBoundsException e){
System.out.println(e);
System.out.println("this line is out of work");
}
}
}
//////////////
以上是代码 应该是有两个异常 一个是 ArithmeticException
一个是 ArrayIndexOutOfBoundsExceptions
但是第二个catch怎么也抓不住这个异常
结构仅显示
0
java.lang.ArithmeticException: / by zero
求大神赐教啊
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
int a =args.length;
System.out.println(a);
int b=2321/a;
int c[]={1};
c[42]=44;
}catch(ArithmeticException e){
System.out.println(e);}
catch(ArrayIndexOutOfBoundsException e){
System.out.println(e);
System.out.println("this line is out of work");
}
}
}
//////////////
以上是代码 应该是有两个异常 一个是 ArithmeticException
一个是 ArrayIndexOutOfBoundsExceptions
但是第二个catch怎么也抓不住这个异常
结构仅显示
0
java.lang.ArithmeticException: / by zero
求大神赐教啊
