characteristics of StringBuffer

Here is the characteristics of StringBuffer class in Java.

  • String buffers are safe for use by multiple threads.
  • Unlike String object, append method doesn’t create an additional String object so String buffers object can save memory.

Because of the second characteristic mentioned right above, when dealing with lots of characters, StringBuffer will come in handy instead of String.

Comment are closed.