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

num.isNaN() method returns returns true if i is not a number and false when i is a number. Here false is returned because i is a number i:e 260.1.



Your comments will be displayed only after manual approval.