Regarding autoboxing...
Basically, if the context requires a wrapper instance (like Integer), you can use a primitive (like int), and
Java will automatically handle the conversion -- boxing the int to an Integer. Conversely, if the context requires a primitive, you can use a wrapper instance, and Java will automatically unbox.
In the example below (which uses a
local variable inside main), a new Integer object is created. But to be assigned to an int variable, it is automatically converted (unboxed) to type int.