
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Float isInfinite Method
The Float.isInfinite() method in Java returns true if this Float value is infinitely large in magnitude, else false is returned.
We have the following Float values
Float f1 = new Float(5.0/0.0); Float f2 = new Float(10.2/0.0); Float f3 = new Float(0.0/0.0);
Check with isInfinite() method
f1.isInfinite(); f2.isInfinite(); f3.isInfinite();
The following is the complete example with output −
Example
import java.lang.*; public class Demo { public static void main(String args[]) { Float f1 = new Float(5.0/0.0); Float f2 = new Float(10.2/0.0); Float f3 = new Float(0.0/0.0); System.out.println(f1.isInfinite()); System.out.println(f2.isInfinite()); System.out.println(f3.isInfinite()); } }
Output
true true false
Advertisements