This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please Help on: Autoboxing-Widening Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please Help on: Autoboxing-Widening" Watch "Please Help on: Autoboxing-Widening" New topic
Author

Please Help on: Autoboxing-Widening

PK Ghosh
Greenhorn

Joined: Aug 08, 2006
Posts: 24
Can anyone help me to provide correct answer:

Which one get preference on "Widening" or "AutoBoxing/Unboxing"

for example:


is it long converted to float ? I am confisued!
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Originally posted by PK Ghosh:
Can anyone help me to provide correct answer:

Which one get preference on "Widening" or "AutoBoxing/Unboxing"

for example:


is it long converted to float ? I am confisued!


Remember that autoboxing will occur when a primitive needs to be treated like an object.

When you use the == between a primitive and a wrapper, then the wrapper will be unboxed first.
PK Ghosh
Greenhorn

Joined: Aug 08, 2006
Posts: 24
Thanks Keith Lynn.
PK Ghosh
Greenhorn

Joined: Aug 08, 2006
Posts: 24
Thanks Keith Lynn.
 
 
subject: Please Help on: Autoboxing-Widening
 
Similar Threads
Confused
Wrapper Assignments from ExamLab
Widening,Boxing and Var-Args Combined
question about primitive type and wrapper class
Method Overloading