We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by JoisFe March 20, 2023
ArrayIndexOutOfBoundsException : 배열의 인덱스는 0에서 배열 크기 -1 사이
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Discussed in https://github.com/orgs/Study-2-Effective-Java/discussions/164
Originally posted by JoisFe March 20, 2023
70. 복구할 수 있는 상황에는 검사 예외를, 프로그래밍 오류에는 런타임 예외를 사용하라
throwable (문제 상황을 알리는 타입)
검사 예외, 런타임 예외, 에러 3가지를 언제 무엇을 사용할지 지침
1. 호출하는 쪽에서 복구하리라 여겨지는 상황이라면 검사 예외를 사용
비검사 throwable 2 가지
2. 프로그램 오류를 나타낼 때는 런타임 예외를 사용
전제조건 위배
ArrayIndexOutOfBoundsException : 배열의 인덱스는 0에서 배열 크기 -1 사이
여야하는 전제조건을 지키지 못한 것제약은 조건에서 문제가 하나 있다면 복구할 수 있는 상황인지 프로그래밍 오류인지가 항상 명확히 구분되지 않음
위의 판단을 내리지 못할 경우 즉 확신하기 어렵다면 아마도 비검사 예외를 선택하는 편이 나음
3. 구현하는 비검사 throwable은 모두 RuntimeException의 하위 클래스여야 함 (직접적이든 간접적이든)
throwable을 언제 사용?
throwable은 이로울 게 없으니 절대 사용하지 말아야 함!!!!!!
예외의 메서드
검사 예외와 예외의 메서드
정리
The text was updated successfully, but these errors were encountered: