300+ free video programming tutorials ― Learn for free!

Java Tutorial - #32 - String vs. StringBuffer

Category: Java - Author: Karl Hadwen

Home > Java > Java Tutorial - #32 - String vs. StringBuffer

Did you find this video helpful? If so, why not subscribe!? ? http://bit.ly/CognitiveSurge

In this video I'll be showing you the difference between String and StringBuffer. To quote a good Stackoverflow source:

String is used to manipulate character strings that cannot be changed (read-only and immutable).

StringBuffer is used to represent characters that can be modified.

Performance wise, StringBuffer is faster when performing concatenations. This is because when you concatenate a String, you are creating a new object (internally) every time since String is immutable.

Like the Cognitive Surge Facebook page
https://www.facebook.com/cognitivesurge

Follow me on Twitter (Feel free to tweet me questions!)
https://twitter.com/karlhadwen