File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Double.NaN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Double.NaN" Watch "Double.NaN" New topic
Author

Double.NaN

rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Can you explain me the output..??


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
hi:
NaN is a constant holding a Not-a-Number value.
NaN doesn't equal anything, not even itself.
so
Double.NaN == Double.Nan// is false
Your created two objects references of type Double. The bit holders for both references refere to Double.NaN.
Then
a.equal(b) will return true


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
It is instructive to look at the source for java.lang.Double - look at the method for equals and for isNaN.
Everybody studying for the exam should have the source (unzip src.zip) and study it when these questions come up.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Double.NaN
 
Similar Threads
NAN Question,Please help.
Majji question - NaN
Double.NaN (Majji Q)
Double doubt
Q'tion from Majji's paper