Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
unboxing issues
Adeyemi Adeseye
Greenhorn
Posts: 27
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can someone explain why this code gives a null pointer exception at runtime
public calss Boxer1{ Integer i; int x; public Boxer1(int y){ x=i+y; Sytem.out.print(x); } public static void main (String... args) { new Boxer1(new Integer(4)); } }
SCJP 6.0 (83%)
Kamil Wojcik
Ranch Hand
Posts: 78
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
because default value for Integer (it's an Object!) is NULL
SCJP 6.0 Passed | SCWCD Passed | PSM in progress...
Adeyemi Adeseye
Greenhorn
Posts: 27
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
oh, tanks, that skipped my mind.
SCJP 6.0 (83%)
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
NullPointerException
Question on Integer type
Wrapper instances question
small swapping problem please please reply!!!!!
BETA: Method resolving, un/boxing varargs mock question
More...