Does Java autobox when assigning an int to an Object?
Will the above code first wrap the int literal 8 in an Integer and then assign its reference to variable ob? Yes. (Or rather, it will box the int value into an Integer object, and then assign the reference to the variable ob. The fact that the integer value is a literal is irrelevant here, … Read more