This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 12675
    
    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


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Double.NaN
 
Similar Threads
Double.NaN (Majji Q)
Majji question - NaN
Double doubt
NAN Question,Please help.
Q'tion from Majji's paper