what is autoboxing in Java 1.5 ?

satya5321's Avatar
Banned
what is autoboxing in Java 1.5 ?.

Hi I came across the word that is introduced in java1.5 : AutoBoxing

can anybody tell what is autoboxing in detail.

Thanks in Advance

Last edited by shabbir; 17Dec2007 at 17:21.. Reason: Confine links to signature
nadunalexander's Avatar
Go4Expert Member
Java provide equivalent class types for primitive types.

int - Integer
double - Double etc...

These classes are called wrapper classes, because they are wrapping the primitive values.
Before java 1.5 to wrap a primitive value there are workarounds.

From java 1.5 it is automated. That is why this is called autoboxing.
from java 1.5 we can write

Integer i=10;
Double d=10.5;

you don't need to write any object creation code
Eg. Double d=new double();