This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes using == 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 "using ==" Watch "using ==" New topic

using ==

rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 86
hi friends please go thru the following code snippets and clarify my doubt.

class comptest

public static void main(String rgs[])
float f=10;
double d=10;



public class comptest1
public static void main(String[] args)
double d = Integer.MAX_VALUE;
float f= Integer.MAX_VALUE;
if (f == d)
System.out.println(" not equal ");

the code of class comptest prints true while the class comptest1 doesnt.please clarify why as we are comparing float and double in both the cases.

Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Have you tried

in comptest2? That might tell you something.
Have you checked out Aspose?
subject: using ==
jQuery in Action, 3rd edition