File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Byte class

 
Sridhar Srikanthan
Ranch Hand
Posts: 366
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I found this question in Sreenivas Majji's Mock Exam question number 9.
The code is
The answer given is false. I checked it by running the answer given is correct. By viewing the question, my instincts led me to the option B(i,e B). Can someone explain how "==" and "equals()" work with Number class and its subclasses.
Thanks in advance
Sri
 
Sarma Lolla
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When ever a toString() method is called a new String object is created wrapping the value of the byte and returned by the system. So the two string objects are never equal in this case.
 
Sridhar Srikanthan
Ranch Hand
Posts: 366
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sarma,
Thanks , I got it now
Sri
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic