Java Double floatValue() method

The floatValue() method of Double class returns a float value of this double object.

Syntax

Parameters

NA

Return value

The floatValue() method returns the double value converted to type float .

Example 1

Output:

55.05587687687 after converted to float becomes : 55.055878

Example 2

Output:

Double value = 9.87979878768757E19
Float value  = 9.879799E19

Example 3

Output:

Error:(19, 24) java: double cannot be dereferenced