Strings in Java are immutable, so any changes create new String objects. StringBuffer and StringBuilder allow mutating strings and are useful in multithreaded environments, with StringBuffer being synchronized and StringBuilder not. StringBuffer has locking overhead. An example shows creating a StringBuffer, appending to it, and printing the result. StringBuilder is similar but unsynchronized for single-threaded use with less overhead than StringBuffer.