Item 75. Failure Information
μ€ν¨ λ©μμ§μ λ΄μ μ 보
class IndexOutOfBoundsException extends RuntimeException {
/**
* IndexOutOfBoundsExceptionμ μμ±νλ€.
*
* @param lowerBound μΈλ±μ€μ μ΅μκ°
* @param upperBound μΈλ±μ€μ μ΅λκ° + 1
* @param index μΈλ±μ€μ μ€μ κ°
*/
public IndexOutOfBoundsException(int lowerBound, int upperBound, int index) {
// μ€ν¨λ₯Ό ν¬μ°©νλ μμΈ λ©μμ§λ₯Ό μμ±νλ€.
super(String.format(
"μ΅μκ°: %d, μ΅λκ°: %d, μΈλ±μ€: %d",
lowerBound, upperBound, index));
// νλ‘κ·Έλ¨μμ μ΄μ©ν μ μλλ‘ μ€ν¨ μ 보λ₯Ό μ μ₯ν΄λλ€.
this.lowerBound = lowerBound;
this.upperBound = upperBound;
this.index = index;
}
}Last updated