Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Java Program to check if a Float is Infinite or Not a Number

public class Demo {
	public static void main(String[] args) {
		float value1 = (float) 1 / 0;
		boolean res1 = Float.isInfinite(value1);
		System.out.println("Checking for isInfinite? = "+res1);
		float value2 = (float) Math.sqrt(9);
		boolean res2 = Float.isNaN(value2);
		System.out.println("Checking for isNan? = "+res2);
	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.