Originally posted by Igor Stojanovic:
... I read about autobox recently and i wonder now do we still have to wrapp primitive variables or autoboxing will do all our job so we can forget about it now?
You can use autoboxing as long as it's clear to the compiler that a wrapped instance is required from the primitive.
For example, instead of...
Integer in = new Integer(5);
...you can simply use...
Integer in = 5;
Of course, you still
can't dereference an int...
String s = 5.toString(); //ILLEGAL
...but you
can do this...
String s = ((Integer)5).toString();
[ February 18, 2005: Message edited by: marc weber ]