1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* Convert double to Double object Example This example shows how a double primitive value can be converted to a Double object */ public class JavadoubleToDoubleExample { public static void main(String[] args) { double d = 10.56; /* Use Double constructor to convert double primitive type to a Double object. */ Double dObj = new Double(d); System.out.println(dObj); } } /* Output of the program would be 10.56 */ |
need to convert a double to a double []
Thank´s a lot. It´s a very nice code that funs ok.
Double(double value)
Deprecated.
It is rarely appropriate to use this constructor. The static factory valueOf(double) is generally a better choice, as it is likely to yield significantly better space and time performance.
you can use ‘autoboxing’:
double d = 10.56;
Double dObj = d;