Win a copy of Mesos in Action this week in the Cloud/Virtualizaton 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