Java Float isInfinite() MethodThe isInfinite() 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 infinitely large in magnitude and returns false for finite floating-point arguments. The isInfinite() method is vice - versa of 'isFinite()' method. Syntax:Parameters:
Return Value:This method returns a Boolean value for this float object.
Example 1Test it NowOutput: Infinity value for isInfinite() method is : true Infinity value for isFinite() method is : false Example 2Test it NowOutput: 1. 2.13909504E9 value = false 2. 7.6E-42 value = false 3. NaN value = false 4. -Infinity value = true Example 3Test it NowOutput: 1. 7.643476E10 value = false 2. 27.827 value = false 3. Infinity value = true 4. -Infinity value = true 5. NaN value = false Example 4Test it NowOutput: Error:(7, 24) java: float cannot be dereferenced Here, float is primitive data type. Its object can't be used to call Float class methods. If done, so it will give the above described error.
Next TopicJava Float
|