Problem Statement
You need to find out if the given double value is not a number in Java.
Solution
Use the method isNaN() defined in the Double class to find out if the given number is not a number in Java.
public class Main {
public static void main(String[] args) {
System.out.println("Abundantcode.com Java Tutorials");
Double input1 = new Double(0/0.);
System.out.println(input1.isNaN());
}
}
The output of the above program is
Abundantcode.com Java Tutorials
true
Leave a Reply