Well - to understand boxing concept in JAVA, you must know the classes and objects concept.
In java everything is object.
For example -
int a=10;
here a is a variable of primitive data type but you can convert this a into object of Integer Type.
Integer a=10;
here a is a object of class Integer.
So conversion of int to Integer is called boxing and reverse way is unboxing
In java everything is object.
For example -
int a=10;
here a is a variable of primitive data type but you can convert this a into object of Integer Type.
Integer a=10;
here a is a object of class Integer.
So conversion of int to Integer is called boxing and reverse way is unboxing
No comments:
Post a Comment