StringBuilder is the mutable counterpart to String. It holds a resizable sequence of characters, and its methods change that sequence in place instead of creating new objects. Use it when you build text in a loop, because repeated String concatenation creates a new object on every step. (StringBuffer has the same methods but is synchronized; StringBuilder is the usual choice.)
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 6 more sections, 4 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.