뭐해먹고 살지
Integer.valueOf(null) 의 Exception은? 본문
Integer.valueOf(null)의 Exception 은 NullPointerException 일까 NumberFormatException 일까?
Test Code
@Test
public void test() {
class A {
String n;
}
A a = new A();
a.n = null;
try {
Integer.valueOf(a.n);
} catch (Exception e) {
e.printStackTrace();
}
}
결과는..
java.lang.NumberFormatException: null
끝!