Autoboxing in Java
Automatic conversion of primitive data type to wrapper Class object is known as autoboxing in Java. Example-
Integer i = 10; //Here compiler automatically convert int to Integer
After compilation, the above code will become
Integer i = Integer.valueOf(10);
It means by using valueOf() autoboxing concept is implemented in Java
Unboxing in Java
Automatic conversion of wrapper class object to primitive by compiler is known as unboxing in Java.
Integer i = new Integer(10);
int i2 = i; // Compiler converts Integer to int