Archive for the 'Exception' Category
Unboxing as a Java Interview Question
19 Comments Published May 14th, 2008 in Exception, Interview, Java, QuestionSometimes I ask an unboxing question during Java interviews. “What can happen with unboxing? See this code:”
Integer i1;
…
// do some things with i1;
…
int i2 = i1;
The thing that can happen is that i1 is NULL which will result in a NullPointerException being thrown.
“What is the problem with the NPE here?” There are several […]