Java Float isFinite() MethodThe isFinite() method of Java Float class returns a Boolean value for the specified float object f. This method returns true if the argument passed is a finite floating-point number else returns false for NaN and infinity arguments. Syntax:Parameters:The parameter passed is 'f' which is of float type. Return Value:This method returns a Boolean value for this float object.
Example 1Test it NowOutput: Value returned is: false Example 2Test it NowOutput: Returned result = true Returned result = true Returned result = false Returned result = false Example 3Test it NowOutput: Error:(7, 23) java: float cannot be dereferenced Here, float is a primitive data type. We cannot use its object to call Float class methods. Also isFinite() is a static method so, it should be called with the class name i.e. Float
Next TopicJava Float
|