ICSE Class 10 Computer Applications Question 6 of 16

Using Library Classes — Question 6

Back to all questions
6
Question

Question 6

What is autoboxing ? What is auto-unboxing ? How are these useful ?

Answer

The automatic conversion of primitive data type into an object of its equivalent wrapper class is known as Autoboxing.

The automatic conversion of an object of wrapper class into primitive data type is known as Auto-unboxing.

These are useful as:

  1. Autoboxing/auto-unboxing let us use primitive types and wrapper class objects interchangeably.
  2. It simplifies the process of converting between primitive types and their corresponding wrapper classes as the compiler does it automatically.