What is the difference between StringBuilder and StringBuffer ?

I, that one, that the second, I use in order to make a line from a knowingly unknown number of parts.

    2 answers 2

    StringBuffer is a legacy from earlier versions of the JDK (up to 1.5). Differs in that it is synchronized.

      Use StringBuilder when working with one thread, StringBuffer when working with many threads.