public class App {
public static void main(String[] args) {
try {
System.out.println(2/0);
} catch (ArithmeticException e) {
System.out.println("ArithmeticException");
} catch (Exception e) {
System.out.println("Exception");
}
}
}
위와 같은 경우 "ArithmeticException" 출력
public class App {
public static void main(String[] args) {
try {
System.out.println(2/0);
} catch (Exception e) {
System.out.println("Exception");
} catch (ArithmeticException e) {
System.out.println("ArithmeticException");
}
}
}
위와 같은 경우 ArithmeticException 부분이 필요 없어짐. "Exception" 출력
'공부 기록 > 영상 후기' 카테고리의 다른 글
[10분 테코톡] 제리의 MVC 패턴 (0) | 2023.04.26 |
---|---|
Java 예외 - 6. checked vs unchecked exception (0) | 2023.04.26 |
[10분 테코톡] 코카콜라의 HTTP 메서드와 상태코드 (0) | 2023.04.26 |
[10분 테코톡] 철시의 요청 응답 흐름 과정 (0) | 2023.04.20 |
서블릿/JSP 강의 03 - 웹 서버 프로그램과 Servlet (0) | 2023.04.20 |