• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

usng StringBuffer

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic