| Author |
What are the three most common approaches for creating wrapper objects
|
Sandra Bachan
Ranch Hand
Joined: Feb 18, 2010
Posts: 434
|
|
Sierra/Bates, Chapter 3:
For the exam you need to understand the three most common approaches for creating wrapper objects..
However the text only brings up:
primitive xxxValue() - to convert a Wrapper to a primitive
primitive parseXxx( String) - to convert a String to a primitive
Wrapper valueOf(String) - to convert a String to a Wrapper
How does xxxValue() and parseXxx() create a wrapper object? It seems that create a primitive from a Wrapper or String, respectively.
I cannot find anywhere in the book that explicity lists the "three most common approaches for creating wrapper objects"
Also searched google and bing. Please help.
|
Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Sandra Bachan wrote:
How does xxxValue() and parseXxx() create a wrapper object? .
It wont.
|
 |
Piotr Nowicki
Ranch Hand
Joined: Jul 13, 2010
Posts: 610
|
|
In my opinion, if you will know the valueOf() along with the most obvious:
and perhaps explicit and implicit autoboxing
you should be fine for the exam :-)
Cheers!
Edit: thanks Wouter :-)
|
OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
|
You're not casting in your example. You're using auto-boxing. A primitive can't be casted because it is not a reference.
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
 |
|
|
subject: What are the three most common approaches for creating wrapper objects
|
|
|