class A {
void abc() throws NumberFormatException {
bcd();
}
void bcd() throws NumberFormatException {
cde();
}
void cde() throws NumberFormatException {
int num = Integer.parseInt("10A");
}
}
public class ExceptoinMethod_2 {
public static void main(String[] args) {
//#1. 객체 생성
A a = new A();
//#2. 메서드 호출 / 예외처리
try {
a.abc();
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
}
java.lang.NumberFormatException: For input string: "10A"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at A.cde(Test.java:9)
at A.bcd(Test.java:6)
at A.abc(Test.java:3)
at Test.main(Test.java:18)
여기서 at java.base/java.lang.Integer.parseInt(Integer.java:652)은 왜 두 번 나오는 거임?
댓글 0