my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes equals 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 "equals" Watch "equals" New topic
Author

equals

meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219

output
not equal
equal
Can anybody explain me why it is showing different output.
[ February 18, 2005: Message edited by: Mark Spritzler ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

First, there is a button underneath the Add Reply button that will put CODE tags around code so that they don't lose their formatting and make it difficult to read.

OK, first what is the MAX_VALUE of double and float? and can you compare that to each other.

Second what about how Java handles comparison of two different primitive types, does it cast up or down, and how does it do it such that the result you see comes out "True"

Good Luck

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Have a look at some of the past threads for explanation.

http://www.coderanch.com/t/245234/java-programmer-SCJP/certification/why-Integer-behaving-differently
http://www.coderanch.com/t/246562/java-programmer-SCJP/certification/Integer-MAX-VALUE-Integer-MAX
http://www.coderanch.com/t/239499/java-programmer-SCJP/certification/Float-Double-Conversion
 
Don't get me started about those stupid light bulbs.
 
subject: equals
 
Similar Threads
Wrapper question...
comparing MAX Values of Wrapper class with float and double
why it is false
About primitive promotion.
Confusing outputs