日期:2014-05-20 浏览次数:21103 次
public int method(){
try{
File f = new File("");
FileInputStream fi = new FileInputStream(f);
return 1;
}catch (Exception e) {
// TODO: handle exception
throw new Exception();
}finally{
System.out.println("1");
return 2;
}
}
public class ExceptionTest {
public static void main(String[] args) {
try {
method();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
System.out.println("finally main");
}
}
public static void method() throws Exception {
try{
throw new Exception();
}finally{
System.out.println("finally method");
}
}
}