What is the difference between these two. I know Boxing is converting primitive values to reference. What is widening. Also what should be the sequence first boxing should b
Widening is transforming a variable in another with a wider type.
Widening can be done with primitive or reference types.
For example :
String
-> Object
int
-> long
As the JLS states :
a boxing conversion (§5.1.7) [is] optionally followed by a widening reference conversion