This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

usng StringBuffer

 
Haris Karameh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when using StringBuffer for efficiency, what exactly is the result of

StringBuffer sb=new StringBuffer();
sb.append...
sb.append...
System.out.println(sb.toString());

What is happening when calling sb.toString().
Is new memory space alocated to accomodate the content of sb, and the content copied to new location, and after recycled?
 
Bupjae Lee
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is implemention of StringBuffer.toString()


Is new memory space alocated to accomodate the content of sb, and the content copied to new location, and after recycled?


You're right.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic