其次,如果将try里面的语句改为int[] a=null;,为什么还是没有正常输出“错误类型:空引用!!!!”语句????
public class Sample6_7{
public static void main(String []args){
try{
int[] a=new int[3];
a[2]=1;
}
catch(Exception e){
e.printStackTrace();
}
catch(NullPointerException npe){
System.out.println("错误类型:空引用!!!!");
}
}
}
子衿沉夜
蝴蝶刀刀