File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes doubt in this snippet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "doubt in this snippet" Watch "doubt in this snippet" New topic
Author

doubt in this snippet

Java Lover
Greenhorn

Joined: Nov 23, 2006
Posts: 12
public class Work1
{
public static void main(String args[])// throws Exception
{
int x =44;

System.out.println(x==x);
}
}

Hi

The output of the above code is:
true

And I want make it as: false


Rule:

1.Change any data type or anything in declaration of the variable.
2.no more changes is System.out.println statements
3.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14192
    
  20

"Java Lover", please check your private messages. You can see them by clicking My Private Messages.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

One hint: doubles and floats have some special values that are not "real" numbers. You can find them in the Double and Float classes. Check those out.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: doubt in this snippet