• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please Help on: Autoboxing-Widening

 
PK Ghosh
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keith Lynn.
 
PK Ghosh
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keith Lynn.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic