
Non-RuntimeExceptionRuntimeException (RuntimeException
public static void main(String[] args) {
int[] intArray = { 10 };
try {
System.out.println(intArray[2]);
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("예외가 발생했지만 처리함: 배열 크기 확인 필요");
}
System.out.println("프로그램 종료합니다.");
}
Throwable의 주요 메서드
throwthrow new XXException
Exception에서 모든 예외를 처리하게 됨으로 Unreachable catch Exception이 발생!Unreachable catch block for Exception의 컴파일 에러 발생finally는 예외 발생 여부와 상관 없이 언제나 실행
try-with-resources
try (리소스_타입1 res = 초기화; 리소스_타입2 res2 = 초기화;...) {
} catch (Exception e) {
}AutoCloseable interface를 구현할 것method에서 처리해야 할 하나 이상의 예외를 호출한 곳으로 전달 (처리 위임)




Unreachable catch block Compile 에러 발생