Computer Applications

Differentiate between boxing and unboxing.

Java Library Classes

ICSE 2024

6 Likes

Answer

Differences between boxing and unboxing are:

BoxingUnboxing
It is the process of converting a primitive type to its corresponding wrapper class object.It is the process of converting a wrapper class object back to its corresponding primitive type.
It occurs when assigning a primitive value to a wrapper object.It occurs when assigning a wrapper object to a primitive variable.
Example:
int num = 10;
Integer obj = num;
Example:
Integer obj = 20;
int num = obj;

Answered By

4 Likes


Related Questions