Float doubleValue() method in Java with examples
Last Updated :
08 Mar, 2024
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
class GFG {
public static void main(String[] args)
{
float a = 17 .65f;
Float b = new Float(a);
double output = b.doubleValue();
System.out.println( "Float value of "
+ b + " is : " + output);
}
}
|
Output:
Float value of 17.65 is : 17.649999618530273
Program 2:
Java
class GFG {
public static void main(String[] args)
{
float a = 6 .0f;
Float b = new Float(a);
double output = b.doubleValue();
System.out.println( "Float value of "
+ b + " is : " + output);
}
}
|
Output:
Float value of 6.0 is : 6.0
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#doubleValue()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...