package YiChang;
public class YiChang {
public static void main(String[] args){
for(int i=0;i<4;i++){
int k;
switch(i){
case 0: int zero=0;
try{
k=911/zero;
}catch(ArithmeticException e){
System.out.println("出现算数异常!");
}
break;
case 1:
try{
int b[]=null;
k = b[0];
}catch(NullPointerException e){
System.out.println("出现空指针异常!");
}
break;
case 2:
int c[]=new int[2];
try{
k=c[9];
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("出现数组序号溢出!");
}
break;
case 3:
try{
char ch="abc".charAt(99);
}catch(StringIndexOutOfBoundsException e){
System.out.println("出现数据类型转换异常!");
}
break;
}
}
}
}