[Exception Handling]

“에러와 예외”

“예외 클래스의 계층”

“try-catch”

public class SimpleException {
    public static void main(String[] args) {
        int[] intArray = { 10 };
        
        try {
        	System.out.println(intArray[2]); // 예외가 발생할 수 있는 코드
        } catch (ArrayIndexOutOfBoundsException e) { // 단건 예외를 받음
        	System.out.println("예외 처리 완료"); // 예외 처리 코드
        }
        System.out.println("프로그램 종료합니다.");
    }
}

“Exception 객체의 정보 활용”

[Throwable의 주요 메서드]

Untitled

“try-catch문에서의 흐름”