Multiple choice

Which of the following options is true?

i. Float and Double classes have only a non-static method i.e. Nan() method.

ii. Float and Double classes have only one static method i.e. Nan() method.

iii. Float and Double classes have one static method i.e. Nan() method, and one non-static method i.e. Nan() method.

iv. Float and Double classes does not have any Nan() method.

  1. i

  2. ii

  3. iii

  4. iv

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This answer is correct. Float and Double classes has a static method is Nan() method taking  float value if it is called from Float class and takes double value if it is called from Double class. Also, Float and Double classes has a non-static method is Nan() which will return true if the invoking object contains a value that is not a number. Else it returns false.