public static void main(String[] args) {
try{
for(int i=0;i<5;i++){
if(i==2){
throw new Exception("错误");
}
System.out.println(i);
}
}catch(Exception e){
System.out.println(e);
}
}
让结果输出01345
try{
for(int i=0;i<5;i++){
if(i==2){
throw new Exception("错误");
}
System.out.println(i);
}
}catch(Exception e){
System.out.println(e);
}
}
让结果输出01345