String

String is immutable object, and therefore is thread safe.

StringBuffer is mutable. The object created through StringBuffer is stored in the heap . StringBuffer has the same methods as the StringBuilder , but each method in StringBuffer is synchronized, that is StringBuffer is thread safe . StringBuilder is faster than StringBuffer, but is not thread safe.

In Java, thread safe means that it may be used from multiple threads at the same time without causing problems.

results matching ""

    No results matching ""