class Nilab { public static void main(String args[]) { Nilab n = new Nilab(); try { n.jikken(); System.out.println("This is a mainTRY."); } catch ( Exception e ) { System.out.println("This is a mainCATCH."); } } void jikken() throws Exception { try { System.out.println("This is a jikkenTRY."); throw new Exception(); } catch ( Exception e ) { System.out.println("This is a jikkenCATCH."); throw e; } finally { System.out.println("This is a jikkenFINALLY."); } } } |
This is a jikkenTRY. This is a jikkenCATCH. This is a jikkenFINALLY. This is a mainCATCH. |