File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about == equals

 
krussi rong
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
here is the question:
Double a = new Double(Double.NaN);
Double b = new Double(Double.NaN);
if(Double.NaN == Double.NaN)
System.out.println("True");
else
System.out.println("False");
if(a.equals(b))
System.out.println("True");
else
System.out.println("False");

So why the answer is False
True.
if Double.NaN == Double.NaN is False,
How the a.equals(b) comes True.
and I really don't know why Double.NaN == Double.NaN if False. and what is NaN?
Thanks
Krussi
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the API Spec for Double. In particular, check out the description of the equals() method.
Corey
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic