This is called Autoboxing which is a feature. That that was added in Java 5 to. It will automatically convert between primitive types and the wrapper types such as double (the primitive) and java.lang.Double (the object wrapper). The java compiler automatically transforms thatthe line:
Double d = 5.1;
into:
Double d = Double.valueOf(5.1);