Consider the following example: if we want to store an int “a” into vector “vt”, we have to use wrapper class. And if we want to get element stored at position “0” of vector “vt”, we again have to do casting.
int a = 10;
Vector vt = new Vector();
vt.add(new Integer(a));
int n = ((Integer)vt.elementAt(0)).intValue();
J2SE 5.0 has made this easy. If we want to do the same in Java 5, the code will be like:
int a = 10;
Vector <integer> vt = new Vector <integer> ();
vt.add(a);
int n = vt.elementAt(0);
ASKER
ASKER
Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.
TRUSTED BY
These are simple examples:
http://www.java-tips.org/blog/java-se/autoboxing-and-unboxing-in-java-5.html