I was looking at the openjdk-1.7.0_25
source code and I have seen this method:
/**
* Returns {@code true} if the specified number is a
* Not-a-Num
Because only NaN compares false with itself. So it will return true when you pass NaN
to the method.
A comparison with a NaN always returns an unordered result even when comparing with itself. ... The equality and inequality predicates are non-signaling so x = x returning false can be used to test if x is a quiet NaN.
Source
It not just about Java, It is also true for all languages following IEEE754 standard.
Related question : Why does Double.NaN==Double.NaN return false?