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

equals()

 
sandhi mridul
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



output: false
true
false
true

As per rule a.equals(null) should always be false for any non-null refrence of a.
Then why at line 2 and line 4 the output is true?

please help me with this.

Thanks
Sandhi
 
Irina Goble
Ranch Hand
Posts: 91
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

creates a Boolean object with value false.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandhi mridul:
...As per rule a.equals(null) should always be false for any non-null refrence of a...

You do not have equals(null) in the above code, because new Boolean(null) creates a Boolean object.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic