- double
is a primitive type, where as Double
is a wrapper object.
- One of the most common use of Wrapper objects is with Collection
.
Eg:
List d = new ArrayList();
- In Java 5 a mechanism called Autoboxing
has been introduced to convert between the two directly.
Eg:
double d = 10.41;
Double wrapper = d;