Autoboxing and Unboxing in Java

In java, we often need to convert primitive types to their object(boxed wrappers) counterparts or vice versa. Unfortunately, doing these conversions all the time is tedious and make code verbose. For this reason, Java 1.5 introduced two concepts, autoboxing and unboxing, that automate these conversions.

Autoboxing: It is the process of converting primitives to their corresponding object type automatically.

Unboxing:It is the process of converting object types to their corresponding primitives automatically.