Sail E0 Webinar
Question


What is the output of this program?


class Output {
public static void main(String args[]) {
Double i = new Double(257.5);
boolean x = i.isNaN();
System.out.print(x);
}
}
Options:
A .  true
B .  false
C .  0
D .  1
Answer: Option B

i.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 257.5.
Output:
$ javac Output.java
$ java Output
false



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers