String vs StringBuffer vs StringBuilder
String
isimmutable
whereasStringBuffer
andStringBuider
aremutable
classesStringBuffer
isthread safe
andsynchronized
whereasStringBuilder
isnot
, thats whyStringBuilder
is morefaster
than StringBuffer- String concat
+
operator internally uses StringBuffer or StringBuilder class - For String manipulations in
non-multi threaded
environment, weshould use StringBuilder