public class Test1{
public String testt() throws Exception{
try {
int i = 9/0;
} catch (Exception e) {
throw e;
}finally{
return "test1";
}
}
}
public class Test2 {
public static void main(String[] args) {
Test1 t = new Test1();
String str = "test2";
try{
str = t.testt();
System.out.println(str);
}catch(Exception e){
System.out.println(str);
}
}
}
上述代码输出“test1”,有没有大神出来解释下为什么Test2里面的catch没有进去?