Here we will learn how to judge if a float number is Infinite using isInfinite() method of the Float class in Java.
Source Code
package com.beginner.examples;
public class FloatIsInfiniteExample {
public static void main(String[] args) {
Float float1 = new Float(1.0 / 0);
// Use the isInfinite() method to determine if it isInfinite
System.out.println(float1.isInfinite());
}
}
Output:
true