+ 2
What does this expression mean?
https://code.sololearn.com/czVzb5TqCGSv/?ref=app Can someone explain me this code ?
1 Odpowiedź
+ 4
NaN means "not a number"
Double.isNaN(your Double) checks if your double is a number or not.
for example:
double a = 0.0/0.0
Double.isNaN(a) returns true because it is not a number
--> print a --> output: NaN
Double.isNaN(-1.0/0.0) returns false because it is a number
(output: - infinity)
Double.isNaN(7) --> false
double a = Double.isNaN does not work.
a tip: if a method starts with is then it returns a boolean (true or false)
isDigit(), isLetter(), ...
You can also look here:
https://www.tutorialspoint.com/java/lang/double_isnan.htm