Tuesday 31 October 2017

Boxing and Unboxingin Java

Boxing and Unboxingin Java

Definition of Auto Boxing

The process of implicitly converting fundamental type values into the equivalent wrapper class object is known as auto boxing.

Converting fundamental type values into object type values:

In order to convert the fundamental data into equivalent wrapper class object type data we use the following generalized predefined parameterized constructor by taking fundamental data type as a parameter.
Example:
Data Conversion
In JDK 1.4 converting fundamental data type values into wrapper class object is known as boxing. In the case of JDK 1.5 and in higher version it is optional to the Java programmer to convert the fundamental data type value into the equivalent wrapper class object. That is implicitly taken care by JVM and it is known as auto boxing.

Definition of auto Unboxing.

In process of implicitly conversion objects type data into fundamental type data is known as auto un-boxing.

Converting object type value into fundamental type value:

In order to convert wrapper class object data into fundamental type data, we use the following predefined instance method present in each and every wrapper class.
Data Conversion
In case of JDK 1.5 and in higher version it is optional to the Java programmer to convert object data into fundamental type data and this process is known as auto un-boxing and it takes care by the JVM.

No comments:

Post a Comment

Data Conversion in java

Data Conversion In java programming we have six data conversion technique they are:. 1 Converting numeric string type data into numeri...