File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boolean comparison

 
geeta rai
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would
if( new Boolean("true") == new Boolean("true"))
be false?
 
allison craig
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Geeta. The == operator checks to see if two objects are one of the same at the heap. The "new" operator was used for each operand thus creating two distinct objects. Using ".equals(..)" will result to true.
 
geeta rai
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! how could i miss that!!! I guess, i've studied alot and its time for me to sleep. Tomorrow is the BIG day :-)
 
allison craig
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your exam is tomorrow? Good luck Geeta!
 
geeta rai
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Allison
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic