Float doubleValue() method in Java with examples
The doubleValue() method of Float class is a built in method to return the value specified by the calling object as double after type casting.
Syntax:
FloatObject.doubleValue()
Return Value: It return the double value of this Float object.
Below programs illustrate doubleValue() method in Java:
Program 1:
// Java code to demonstrate // Float doubleValue() method class GFG { public static void main(String[] args) { // Float value float a = 17.65f; // wrapping the Float value // in the wrapper class Float Float b = new Float(a); // doubleValue of the Float Object double output = b.doubleValue(); // prdoubleing the output System.out.println("Float value of " + b + " is : " + output); } } |
chevron_right
filter_none
Output:
Float value of 17.65 is : 17.649999618530273
Program 2:
// Java code to demonstrate // Float doubleValue() method class GFG { public static void main(String[] args) { // Float value float a = 6.0f; // wrapping the Float value // in the wrapper class Float Float b = new Float(a); // doubleValue of the Float Object double output = b.doubleValue(); // prdoubleing the output System.out.println("Float value of " + b + " is : " + output); } } |
chevron_right
filter_none
Output:
Float value of 6.0 is : 6.0
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#doubleValue()
Recommended Posts:
- DoubleAdder doubleValue() method in Java with Examples
- Short doubleValue() method in Java with Examples
- DoubleAccumulator doubleValue() method in Java with Examples
- Byte doubleValue() method in Java with examples
- LongAdder doubleValue() method in Java with Examples
- LongAccumulator doubleValue() method in Java with Examples
- Number.doubleValue() method in java with examples
- Double doubleValue() method in Java with examples
- AtomicLong doubleValue() method in Java with examples
- AtomicInteger doubleValue() method in Java with examples
- Java Guava | Floats.indexOf(float[] array, float[] target) method with Examples
- Java Guava | Floats.indexOf(float[] array, float target) method with Examples
- Float isNaN() method in Java with examples
- Float parseFloat() method in Java with examples
- Float compareTo() method in Java with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

