aspose file tools*
The moose likes Beginning Java and the fly likes Question about wraper classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question about wraper classes" Watch "Question about wraper classes" New topic
Author

Question about wraper classes

sambasivarao laghuvarapu
Greenhorn

Joined: Jun 07, 2007
Posts: 9


In the above code, why is it returning "true"?.

Thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18845
    
  40

Originally posted by sambasivarao laghuvarapu:

In the above code, why is it returning "true"?.

Thanks


First, your code doesn't compile. You have problems with the braces.



Second, after fixing the braces, the code returns "false".

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
sambasivarao laghuvarapu
Greenhorn

Joined: Jun 07, 2007
Posts: 9
Sorry it was wrong from my end. My intention was - Why it is returning "false"?

Thnaks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18845
    
  40

Originally posted by sambasivarao laghuvarapu:
Sorry it was wrong from my end. My intention was - Why it is returning "false"?

Thnaks


It is returning false because the wrapper classes define equality as having the same type and value. The objects that you are comparing are not the same type.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about wraper classes