This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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

Win a copy of Java 8 in Action this week in the Java 8 forum!
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 ==
Similar Threads
equals method
About Wrapper classes.
about Float and Double
Float Confusion