This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes usng StringBuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "usng StringBuffer" Watch "usng StringBuffer" New topic
Author

usng StringBuffer

Haris Karameh
Ranch Hand

Joined: Oct 17, 2002
Posts: 38
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

Joined: May 14, 2007
Posts: 107
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: usng StringBuffer
 
Similar Threads
Issue with CSV file generated using Java
commandButton inside messages
Doubt.......null?
Formatting Email Content - Beginner
PreparedStatement problem; Doesn't happen with plain SQL