Java Learner logo
← Exit to Module 9: Advanced Core Features lessons
Module progress · 0%Lesson · 12 min

Module 9: Advanced Core Features

Lesson focus

StringBuilder vs StringBuffer

Pick the correct mutable string class for single-threaded or synchronized scenarios.

StringBuilder is unsynchronized and ideal for local operations.

StringBuffer synchronizes methods and may be necessary when multiple threads share an instance.

Prefer returning immutable Strings from APIs even if constructed with builders internally.

Lesson quiz

Why is StringBuilder usually faster than StringBuffer?

Next lesson →