Originally posted by ramya ramya: In JLS it is mentioned that : " x!=x is true if and only if x is NaN," and "The equality operator == returns false if either operand is NaN" But while compiling the below code,it returns just opposite
Note that you're boxing the output of 0.0f/0.0f into a Float instead of storing it in a float.
If you change the type of f to float or compare f against Float.NaN, you will see the output that you are expecting to see from the conditional operators. [ September 01, 2006: Message edited by: Keith Lynn ]
Joined: Aug 11, 2006
Thanks a lot for reply ,You are right ,If i replaced it to float f ,It works fine but why it is not working for Float f ,means making an object of Float. Is there any object related concept in this .
Is it not covered in SCJP as it is floating point types,Please suggest.