GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Float and == Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Float and ==" Watch "Float and ==" New topic
Author

Float and ==

srinivas sridaragaddi
Ranch Hand

Joined: Jul 24, 2007
Posts: 225


output:
false
true
false


float by default is double so why 2 is returning false.


SCJP 5.0<br /> <br />"Skills are started with learning and mastered with improvement. Nothing is hereditary except death" BUDDHA...
Gautam Pandey
Greenhorn

Joined: Sep 21, 2007
Posts: 21
Hi ,

equals method for Wrapper classes returns true if both the value inside the wrapper classes are equal and they are of the same type(Double,Float..etc).
 
GeeCON Prague 2014
 
subject: Float and ==