Java Float isNaN() methodThe isNaN() method of Java Float class returns a Boolean value for the specified float object or for 'v'. This method returns true if the argument passed is Not a Number (NaN), else returns false. Syntax:Parameters:
Return Value:This method returns a Boolean value for this float object.
Example 1Test it NowOutput: 1. NaN value = true 2. NaN value = true 3. 0.1 value = false Example 2Test it NowOutput: Enter two float no. 1. Enter Positive float number = 89 Ans. Square root of 89.0 value = 9.433981 2. Enter Negative float number = -956 Ans. Square root of -956.0 value = NaN Example 3Test it NowOutput: Enter Positive float number = 767 1. 767.0/0.0 - 767.0/0.0 = NaN value is true 2. 767.0/0.0 * 0.0 = NaN value is true 3. 767.0*0.0 / 0.0 = NaN value is true 4. NaN - 768943453 = NaN value is true
Next TopicJava Float
|