+ 8
what is the difference between String , StringBuilder & StringBuffer classes
2 Answers
+ 3
You use String when an immutable structure is appropriate; obtaining a new character sequence from a String may carry an unacceptable performance penalty, either in CPU time or memory (obtaining substrings is CPU efficient because the data is not copied, but this means a potentially much larger amount of data may remain allocated).
You use StringBuilder when you need to create a mutable character sequence, usually to concatenate several character sequences together.
You use StringBuffer in the same circumstances you would use StringBuilder, but when changes to the underlying string must be synchronized (because several threads are reading/modifyind the string buffer).
+ 2
i know that StringBuilder is faster than String but for more information visit oracle website