Java Float.isNaN()
Syntax
Float.isNaN() has the following syntax.
public boolean isNaN()
Example
In the following code shows how to use Float.isNaN() method.
public class Main {
//from w ww. j av a 2s.c o m
public static void main(String[] args) {
Float f1 = new Float(-1.0/0.0);
Float f2 = new Float(0.0/0.0);
System.out.println(f1 + " = " + f1.isNaN());
System.out.println(f2 + " = " + f2.isNaN());
}
}
The code above generates the following result.