class MultiAbnormality2 {
static void Disp(int n)
{
int a=1,b=0;
int arr[]=new int[3];
switch(n)
{
case 0:arr[5]=20;break;
case 1:a=15/b;break;
}
}
public static void main (String args[])
{
int i;
for(i=0;i<2;i++)
{
try{
System.out.println("i="+i);
Disp(i);
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("数组下标越界异常:"+e);
}
catch(ArithmeticException e)
{
System.out.println("除数为零异常!");
}
finally
{
System.out.println("执行finally代码块!");
}
}
}
}
MultiAbnormalit2(week12)
最新推荐文章于 2020-11-28 12:07:15 发布