Last Updated: June 6, 2026
The previous lesson covered the synchronized method modifier, which locks the whole body of a method on either this (for instance methods) or the class object (for static methods). That works, but it's a blunt tool: the lock covers every line of the method, even lines that don't touch shared state. A synchronized block lets you draw a tighter circle around the section that needs protection, and lets you choose which object to lock on. This lesson covers the syntax, why narrower critical sections matter, how to pick a lock object that won't cause problems, and how to split unrelated shared state across multiple locks in the same class.