Cosmic Q&A
What is auto boxing and unboxing?
Answer
Auto boxing refers to automatic conversion or "boxing" of primitive data types into their corresponding wrapper classes. For instance conversion of int to Integer wrapper. As a developer you do not have to worry about manually doing the conversion, the compiler will ensure that auto boxing happens during compile time. Unboxing is the other way round, it is the conversion of wrapper types to primitive type. Again, as a developer we need not worry about manual type casting, the Java compiler takes care of unboxing.
Share this page:
Report Error in Content