Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Boxing and Unboxing

Boxing refers to the conversion of a primitive to a corresponding wrapper instance, such as from an int to a java.lang.Integer. Unboxing is the conversion of a wrapper instance to a primitive type, such as from Byte to byte. public class MainClass{   public static void main(String[] args){            Integer number = new Integer (100);      int [] ints = new int [2];      ints [0] = number;   } }