Home » Java Float doubleValue() method with Examples

Java Float doubleValue() method with Examples

by Online Tutorials Library

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

Test it Now

Output:

New value is = 55.05500030517578 

Example 2

Test it Now

Output:

Float value = -5.55898E36 Double value  = -5.558980006458046E36 

Example 3

Test it Now

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

You may also like