What is the difference between boxing and unboxing in Java?
Basis | Boxing | Unboxing |
---|---|---|
Basic | The object type refers to its value type. | It is the process of fetching value from the boxed object. |
Storage | The value stored on the stack is copied to the object stored on the heap memory. | The value of the object stored on the heap memory is copied to the value type stored on the stack. |
Conversion | Implicit | Explicit |
Example | Int n = 24; Object ob = n; |
Int m = (int) ob; |
BY Best Interview Question ON 03 May 2022