Sun introduced the StringBuilder class in J2SE 5.0, which is almost the same as StringBuffer, except it\\''s not thread-safe. Thread safety is usually not necessary with StringBuffer, since it is seldom shared between threads. When Strings are added using the + operator, the compiler in J2SE 5.0 and Java SE 6 will automatically use StringBuilder. If StringBuffer is hard-coded, this optimization will not occur.
No comments:
Post a Comment