Exception n Exception Class Not Found Exception Illegal

  • Slides: 10
Download presentation

例外(Exception)の型 n Exception Class. Not. Found. Exception ² Illegal. Access. Exception ² Instantiation. Exception

例外(Exception)の型 n Exception Class. Not. Found. Exception ² Illegal. Access. Exception ² Instantiation. Exception ² Interrupted. Exception ² No. Such. Field. Exception ² No. Such. Method. Exception ² Runtime. Exception ² 12/13/2021 4

例外(Runtime. Exception) の型 n Runtime. Exception Array. Index. Out. Of. Bounds. Exception ² Arithmetic.

例外(Runtime. Exception) の型 n Runtime. Exception Array. Index. Out. Of. Bounds. Exception ² Arithmetic. Exception ² Class. Cast. Exception ² Negative. Array. Size. Exception ² Null. Pointer. Exception ² Number. Format. Exception ² Security. Exception ² String. Index. Out. Of. Bounds. Exception ² 12/13/2021 5

例外を投げる(かもしれない)関数 public static void a. Method() throw Exception { … throw new Exception(“エラーメッセージ”); …

例外を投げる(かもしれない)関数 public static void a. Method() throw Exception { … throw new Exception(“エラーメッセージ”); … } 12/13/2021 6

例外を投げる(かもしれない)関数 public static void a. Method() throw Exception { … throw an. Object; …

例外を投げる(かもしれない)関数 public static void a. Method() throw Exception { … throw an. Object; … } an. Objectは、例外のサブクラスでなければならない 12/13/2021 7

例外を投げる(かもしれない)関数 public static void a. Method() throw Exceptiontype { … try { } catch

例外を投げる(かもしれない)関数 public static void a. Method() throw Exceptiontype { … try { } catch (Exceptiontype param) { … throw param; … } 12/13/2021 8

例外を受け取れる関数 public static void main() { try { exception. Thrownable. Method(); } catch (Exception

例外を受け取れる関数 public static void main() { try { exception. Thrownable. Method(); } catch (Exception e) { System. err. println(e. get. Message()+”n”); exception. print. Stack. Trace(); } 呼び出しの履歴を表示する。 12/13/2021 9

Divide. By. Zero. Testプログラ ム Jframe 多重継承 Action. Listener Divide. By. Zero. Test Arithmetic.

Divide. By. Zero. Testプログラ ム Jframe 多重継承 Action. Listener Divide. By. Zero. Test Arithmetic. Exception 例外クラスのサブクラス Divide. By. Zero. Exception 12/13/2021 10