Computer Applications

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

Java Library Classes

10 Likes

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.

Answered By

7 Likes


Related Questions