prindhorn-avatar

What is the main difference between the String class and the String Buffer class?

Describe about the concept behind the string class and string buffer class?
over 13 years ago
0%

8 replies

over 13 years ago
freddye-avatar
"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: String str = new String (""Stanford ""); str += ""Lost!!""; "
over 13 years ago
karthur-avatar
"Chain is utilized to govern persona string section that can't possibly be modified (study-solely as well as changeless). StringBuffer is needed to symbolize heroes that could be changed. Overall performance sensible, StringBuffer will be quicker while acting concatenations. It is because whenever you concatenate A String, you are making a completely new thing (internally) when since Chain is definitely immutable."