File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wrapper Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wrapper Class" Watch "Wrapper Class" New topic
Author

Wrapper Class

deshdeep divakar
Ranch Hand

Joined: Apr 19, 2004
Posts: 91
This is a Question from Danch

According to me the Output should be:false,true,true.becoz valueOf();
method is just another way to construct wrapper object,and when we compare
two different object references it returns false.While the idea i have got
from the explanation of Question is their is a huge difference between
saying:
But Still the thing left dangling is,is'nt both the objects are different.
plz elobrate on to this as soon as possible.

Thanks
Java Man
Deshdeep


"Do not be afraid of going slow, be afraid of standing still"
deshdeep divakar
Ranch Hand

Joined: Apr 19, 2004
Posts: 91
Hi,
All Ranchers have a close look to this code

Output:
false,true
false,true
true,true,true
whether according to me
Output:
false,true
false,true
false ,true,true
which is coz we r comparing two different object references via ==
plz elobrate to this...
parimelazhagan vinayagam
Greenhorn

Joined: Apr 19, 2004
Posts: 16
Hi,
Bolleans true and false are stored in literal pools...so there will be only two values...that never get change. and references are pointing to these values only..Depends on the value,it will point to either false or true..so the results...


Thanks
Pari
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wrapper Class