What is boxing and unboxing?
Wrapper classes are those whose objects wraps a primitive data type within them. In the java.lang package java provides a separate class for each of the primitive data type namely Byte, Character, Double, Integer, Float, Long, Short.
Converting primitive datatype to object is called boxing.
Example
Integer obj = new Integer ("9339");
Whereas, converting an object into corresponding primitive datatype is known as unboxing.
Example
public class Sample { public static void main (String args[]){ Integer obj = new Integer("9339"); int i = obj.intValue(); System.out.println(i); } }
Output
9339