JAvaのexception throw try catch

3010 ワード

 1 import java.util.*;

 2 

 3 public class MyException extends Exception {

 4 

 5     private static final Exception Exception = null;

 6     private static final Exception NullPointerException = null;

 7 

 8     public static void main(String[] args) {

 9         try {

10             throw (NullPointerException);

11         } catch (NullPointerException e) {

12             System.out.println("@@@@@");

13         } catch (Exception e) {

14             System.out.println("$$$$");

15         } finally{

16             System.out.println("#####");

17         }

18     }

19 

20 }

 
結果:
@@@@@#####