string vs stringbuffer

String vs StringBuffer vs StringBuilder

Three classes exist in java.lang package to manipulate strings – String, StringBuffer and StringBuilder. Even though all the three are used for manipulating strings only but they differ in many aspects and specifically used in the code where demanded. Following tables give the differences between these and when to use.…