108
Java Float doubleValue() method
The doubleValue() method of Java Float class returns a double value corresponding to this Float Object by widening the primitive values or in simple words by directly converting it to double via doubleValue() method .
Syntax:
Parameters:
NA
Return Value:
This method returns the double value which has been converted from the float value of this object.
Example 1
Output:
New value is = 55.05500030517578
Example 2
Output:
Float value = -5.55898E36 Double value = -5.558980006458046E36
Example 3
Output:
Error:(13, 22) java: float cannot be dereferenced
Here double is a primitive data type its object can’t be used to call the Float class method. If done so it will give the above error.
Next TopicJava Float