aspose file tools*
The moose likes Performance and the fly likes About String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "About String" Watch "About String" New topic
Author

About String

Devi Priya
Greenhorn

Joined: Dec 11, 2004
Posts: 1
What is the exact difference between String and Stringbuffer class?
uday tiruveedula
Greenhorn

Joined: Dec 11, 2004
Posts: 2
String is immutable where as StringBuffer is mutable. The significant performance difference between these two classes is that StringBuffer is faster than the String when performing simple concatenations.

More info can be obtained at
http://www.javaworld.com/javaworld/jw-03-2000/jw-0324-javaperf.html

or have a look at
http://www.precisejava.com/javaperf/j2se/StringAndStringBuffer.htm
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by uday kiran t v:
The significant performance difference between these two classes is that StringBuffer is faster than the String when performing simple concatenations.


More specifically, StringBuffer is faster for concatenations that cannot be done in a single expression, i.e. when it's done in a loop.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About String