Java Boxing and Unboxing

Advertisements

Prev Tutorial Next Tutorial

Boxing and Unboxing 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.


Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements