Quantcast
Channel: JavaPins - Stories tagged with immutable
Viewing all articles
Browse latest Browse all 8

StringBuffer versus String - JavaWorld

$
0
0
Java provides the StringBuffer and String classes, and the String class is used to manipulate character strings that cannot be changed. Simply stated, objects of type String are read only and immutable. The StringBuffer class is used to represent characters that can be modified. The significant performance difference between these two classes is that StringBuffer is faster than String when performing simple concatenations. In String manipulation code, character strings are routinely concatenated. Using the String class, concatenations are typically performed as follows:
Pin it

Viewing all articles
Browse latest Browse all 8

Trending Articles