File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Float and ==

srinivas sridaragaddi
Ranch Hand

Joined: Jul 24, 2007
Posts: 225


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

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).
I agree. Here's the link:
subject: Float and ==
It's not a secret anymore!