We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75a0835 commit 5f265e2Copy full SHA for 5f265e2
CustomException.java
@@ -0,0 +1,22 @@
1
+package kr.ac.kookmin.cs.opp.ch5;
2
+
3
+public class CustomException extends RuntimeException {
4
+ public CustomException(String message) {
5
+ super(message);
6
+ }
7
+ public void nullPointException() {
8
+ String name = null;
9
10
+ public void throwCustomException() throws CustomException{
11
+ try {
12
+ nullPointException();
13
+ } catch (NullPointerException npe) {
14
+ throw new CustomException("converting NPE to Custom Exception");
15
+ // return; //catch가 실행됐으면 무조건 어떤상황도 실행된다
16
+ } finally { // 무조건 실행됌 종료하는 코드가 있어도 이건 실행되고 끝남.
17
+ System.out.println("Finally block execution"); // 컴퓨터 자원
18
19
+ System.out.println("하하"); //이건 실행안됌 throw는 실행을 종료시키기 때문에 finally 만 실행시키고 종료시킴
20
21
22
+}
0 commit comments