File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes unboxing issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "unboxing issues" Watch "unboxing issues" New topic

unboxing issues

Adeyemi Adeseye

Joined: Jan 10, 2009
Posts: 27
can someone explain why this code gives a null pointer exception at runtime

SCJP 6.0 (83%)
Kamil Wojcik
Ranch Hand

Joined: May 19, 2008
Posts: 78

because default value for Integer (it's an Object!) is NULL

SCJP 6.0 Passed | SCWCD Passed | PSM in progress...
Adeyemi Adeseye

Joined: Jan 10, 2009
Posts: 27
oh, tanks, that skipped my mind.
I agree. Here's the link:
subject: unboxing issues
Similar Threads
Wrapper instances question
BETA: Method resolving, un/boxing varargs mock question
small swapping problem please please reply!!!!!
Question on Integer type