About author  I am Java/oracle professional.Working on Java/J2EE technologies and i.e Java,J2ee,Oracle ADF,hibernate,J2ee,PL/sql,Apps for 4+ years.I am passionate about learning new technologies.I am sharing my knowledge. Give your views and suggestion on vinay@techartifact.com http://www.linkedin.com/in/vinaykumar2 Read more from this author


Automatic conversion of primitive types and their corresponding object wrapper classes (eg, int and Integer, double and Double, etc).
Autoboxing is a new feature java 1.5 . It is a capability to convert or cast between object wrapper and it’s primitive type.it was necessary to wrap a primitive type to a Wrapper class before adding it to a collection i.e is called Boxing and to unwrap it back to the primitive when it came out of the collection i.e unboxing.

Auto-boxing and Auto-Unboxing enables the primitive types to be converted into respective wrapper objects and the other way around.
Before jdk 1.5 we need to manual boxing.We have to write tedious coding for that.

example-
Integer vinay();

int i = vinay();

Difference between autoboxing and Casting-

Boxing - Boxing is when you use or make primitive type to a reference type
Casting – Casting is when you want one type to treated as another type, between primitive types and reference types

One Response to Autoboxing In java


  1. Jacqualine SulipizioNo Gravatar
    May 26, 2011

    Can I simply communicate what a elimination to find celebrity who really is aware of what theyre speaking relating to on the web. You completely acknowledge the best way to carry an matter to gentle and build it significant. Extra people need to learn this plus perceive this facet of the narrative. I cant believe youre not more popular since you positively have the gift.

Leave a Reply