Is this autoboxing?
Object ob = 8;
Will the above code first wrap the int literal 8 in an Integer and then assign its reference to variable
This specific case is detailed in the assignment conversions:
Assignment conversion occurs when the value of an expression is assigned (§15.26) to a variable: the type of the expression must be converted to the type of the variable.
Assignment contexts allow the use of one of the following:
- [...]
- a boxing conversion optionally followed by a widening reference conversion
So in your case:
8 (int) === boxing ===> 8 (Integer) ==== reference widening ===> 8 (Object)