StringBuffer vs StringBuilder in Java
Both are mutable text builders. StringBuffer methods are synchronized — thread-safe, slower. StringBuilder is not synchronized — faster, one thread.
Student programs almost always want StringBuilder. Pick StringBuffer only if two threads share the same buffer.
String itself is immutable. Don’t confuse all three.
Let's take this on the board with one tiny Main class — no extra files. StringBuffer vs StringBuilder in Java — output: Hi Java. append changes the same StringBuilder — not a new String each time. Start from main, go line by line, and stop at each print. That output is the proof for StringBuffer vs StringBuilder.
Builder for one thread. Buffer if shared. String cannot change.