Double d = 10.23; double d1 = d.doubleValue(); System.out.println("Double value is: " + d); System.out.println("Primitive double value is: " + d1);
String str = "3.14"; double d = Double.valueOf(str).doubleValue(); System.out.println("Primitive double value is: " + d);Output: Primitive double value is: 3.14 In this example, we have initialized a String with the value of "3.14". We have then used the Double.valueOf() method to convert the String to an object of Double, and then used the doubleValue() method to convert the Double object to a primitive double. The doubleValue() method is a member of the java.lang.Double class - a part of the java base package.