public static void main(String[] args) { try{ throw new NullPointerException(); }catch(NullPointerException e){ System.out.println("异常被抓住了!"); }finally{ System.out.println("finally"); } System.out.println("异常了还执行吗?");}//--异常被抓住了!finally异常了还执行吗?
// try{ throw new NullPointerException();// }catch(NullPointerException e){// System.out.println("异常被抓住了!");// }finally{// System.out.println("finally");// }// System.out.println("异常了还执行吗?");//- System.out.println("异常了还执行吗?"); 编译时异常
try{ throw new NullPointerException();}catch(ArrayIndexOutOfBoundsException e){ System.out.println("异常被抓住了!");}finally{ System.out.println("finally");}System.out.println("异常了还执行吗?");//-finallyException in thread "main" java.lang.NullPointerException at loowj.plugin.db.SQL.main(SQL.java:18)