Java Float floatValue() methodThe floatValue() method of Java Float class returns the float value of this object. Syntax:Parameters:NA Return Value:This method returns the float value of the argument. Example 1Test it NowOutput: Result after being converted to float value = 5.0 Result after being converted to float value = 5.7 Example 2Test it NowOutput: Error:(12, 21) java: float cannot be dereferenced Here, float is a primitive data type. Its object can't be used to call Float class method. If you do so, it will give you an error. Example 3Test it NowOutput: Float value = -9.879799E19 Float value = -8276372.0
Next TopicJava Float
|