Forums Register Login

About String

+Pie Number of slices to send: Send
What is the exact difference between String and Stringbuffer class?
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 

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.
You've gotta fight it! Don't give in! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1104 times.
Similar Threads
String & StringBuffer -- Difference
string vs stringbuffer
Difference between String and StringBuffer
What Are the Differences Between String and StringBuffer
Technical Interview Questions
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:08:08.