This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String manipulation

 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i found it in mock test

could someone explain how it works? and why is it so?
 
Bob Wheeler
Ranch Hand
Posts: 317
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
??? why is sb1.equals(sb2) false?
 
Madhu Desai
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob Wheeler wrote:


Then, how to check the values between two StringBuffers are equal?
 
Bob Wheeler
Ranch Hand
Posts: 317
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Madhu Desai wrote:
Bob Wheeler wrote:


Then, how to check the values between two StringBuffers are equal?


Use the StringBuffer.toString() method and equals on base on the String class equals-method. This would be my proposal:


StringBuffer is final, so you can't sublclass it and create your own equals method.

cheers
Bob
 
Madhu Desai
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob Wheeler wrote:
StringBuffer is final, so you can't sublclass it and create your own equals method.

cheers
Bob


Thanks...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic