Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Can't find symbol

Tags:

java

tostring

nan

In Javadoc it was written that :

public static String toString(double d)

Returns a string representation of the double argument. All characters mentioned below are ASCII characters.

If the argument is NaN, the result is the string "NaN".

But when I am compiling below code it is giving error: Cant find symbol NaN

String intStr2 =Double.toString(NaN); 
like image 503
Sukhbir Avatar asked Aug 01 '26 02:08

Sukhbir


1 Answers

Since NaN is not defined, it throws a compilation error, use the following to overcome the same,

String intStr2 = Double.toString(Double.NaN);
like image 168
Sathish Avatar answered Aug 02 '26 16:08

Sathish