J2SE关于几个特殊的异常情况的疑问!
研究简单异常的时候遇到了这样二个问题,各位帮忙分析,
第一题:
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"); } }}