Home » JAVA Programming » Object & Classes » Question
  1. What is the output of this program?
    public class isNaN_Example 
    {
    public static void main(String args[])
    {
    Double num = new Double(1 / 0.);
    boolean p = num.isNaN();
    System.out.print(p);
    }
    }
    1. true
    2. false
    3. 0
    4. 1
    5. None of these
Correct Option: B

isisNaN() method returns true is the value being tested is a number. 1/0. is infinitely large in magnitude, which cannot be defined as a number hence false is stored in p.



Your comments will be displayed only after manual approval.