Different between Boxing and Unboxing?
Satheesh Kumar Pilli
In a simple word we can say that : Boxing is a process of converting the Value Type into Object Type Example :- Object obj;int a =125; obj=a; While UnBoxing is a process of retrieving the origional type(Value Type) from the Object Type. Example:- a=(int)obj;
1. BoxingIf at all a value type is assigned to a refernce type variable we call it as "Boxing"Eg- int i=99; //varialbe initialization Object obj=i; //Assign variable to obj(i.e Boxing)2. UnboxingConverting reference type back into value type is known as "Unboxing"Eg- int j=(int)obj; //(unboxing)