This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I passed scjp exam long back but I still have a question! How can this return true??? new Float(Float.NaN).equals(new FLoat(Float.NaN)) I thought comparison with NaNs always return false! thanks. Derek.
The object of Float class contains member with primitive type 'float' Thus I think in case: new Float(Float.NaN).equals(new FLoat(Float.NaN)) Java compares float primitives into the Float objects And in this case: System.out.println(new Float(Float.NaN)==new Float(Float.NaN)); Java compares refernces to Float objects. And there are different references.