After this it has been told we are not allowed to do wideing and then boxing but reverse is true.. and the boxing followed by widening example given is as below , i am okay with example :
My doubt is that is our original problem of converting from byte to Long is resolved (as was in first example ) ? as it is not rectified in second example ( in the second example we just achieved conversion from byte to Byte..)
Please put some light on it...
[BPSouther: Added code tags] [ February 14, 2008: Message edited by: Ben Souther ]
Your second example works because the primitive byte b can be boxed to a Byte, and then the Byte reference can be upcast to type Object (because Byte is a subclass of Object).
But your first example is different because Byte is not a subtype of Long. Both of these are direct subclasses of Number. Therefore, a Byte reference cannot be upcast to type Long. [ February 15, 2008: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org