I'm studying for the SCJP exam and I ran into an issue I can't really wrap my head around.
The book says you can't widen and then box, but you can box and then widen. The example for not being able to box is a method expecting a Long and the method being invoked with a byte.
Their explanation is:
Think about it…if it tried to box first, the byte would have been converted to a Byte. Now we're back to trying to widen a Byte to a Long, and of course, the IS-A test fails.
But that sounds like box and then widen and not widen and then box to me.
Could anyone clarify the whole box and widen vs widen and box for me because as it stands the book isn't exactly clear on the issue.
Edit: To clarify: I'm talking about pages 252 and 253 of the SCJP sun certified programmer for java 6 book. http://books.google.be/books?id=Eh5NcvegzMkC&pg=PA252#v=onepage&q&f=false
byte
tolong
, so it's a widen first. It's still not clear? – Winny