How to use isNaN() method of the Double class - Java Language Basics

Java examples for Language Basics:double

Description

How to use isNaN() method of the Double class

Demo Code


public class Main {
 
  public static void main(String[] args) {
    double d = Math.sqrt(-10);
    boolean b1 = Double.isNaN(d);
    System.out.println(b1);//from   w w w.j a  va 2  s  .c o m
 
    Double dObj = new Double(d);
    boolean b2 = dObj.isNaN();
    System.out.println(b2);
  }
}

Result


Related Tutorials