Convert double primitive type to a Double object with Double constructor in Java
Description
The following code shows how to convert double primitive type to a Double object with Double constructor.
Example
/*from www . jav a2 s . co m*/
public class Main {
public static void main(String[] args) {
double d = 10.56;
Double dObj = new Double(d);
System.out.println(dObj);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »