_____________ is the process of converting a primitive type data into its corresponding wrapper class object instance.

Options
- unboxing
- autoboxing


CORRECT ANSWER : autoboxing

Discussion Board
Autoboxing

Autoboxing is the name that is used to present automatic converstion of primitive type to their corresponding object wrapper classes. Java compiler makes this automatic conversion possible. For example: converting an int to an Integer, a double to a Double, and so on.

Example of autoboxing:

Character ch = 'a';

So converting a primitive value (an int, for example) into an object of the corresponding wrapper class (Integer) is called autoboxing.

The criteria in which Java compiler applies autoboxing:

1. When a primitive value is passed as a parameter to a method that might be expecting an object of the corresponding wrapper class.
2. When the primitive value is assigned to a variable of the corresponding wrapper class.

Rohit Sharma 08-6-2014 06:07 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement