Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   what is autoboxing in Java 1.5 ? (http://www.go4expert.com/forums/autoboxing-java-15-t7887/)

satya5321 17Dec2007 16:35

what is autoboxing in Java 1.5 ?
 
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

nadunalexander 16Jan2008 11:20

Re: what is autoboxing in Java 1.5 ?
 
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();


All times are GMT +5.5. The time now is 04:40.