Nan is a special number having a unique property that one Nan is not equal to another Nan. In java a floating point variable can be assigned Nan as a value.
So, someType = float & someValue = Float.Nan or 0.0f/0.0f, gives you the desired result!
class Equals { publicstaticvoid main(String args[]){ float x = Float.NaN; System.out.println(x == x) //This prints false!! } }
No comments:
Post a Comment
Solution for this question?