There are many differences between String
and (StringBuilder
or StringBuffer
) like mutability and many string operations
May be this question seems a bit silly, but I want to know for the sake of programming paradigm.
I want to ask, why has Java implemented another class, StringBuilder
or StringBuffer
for a data structure like String
. Why have they not given those features in String
itself.
Why not make String
itself thread-safe or provide some extra features that StringBuilder
or StringBuffer
has?