Há algumas semanas durante os meus estudos para a OCJP, me deparei com este problema que está no capítulo de Threads do livro da Kathy Sierra:
In this exercise we will attempt to synchronize a block of code. Within that block of code we will get the lock on an object, so that other threads cannot modify it while the block of code is executing. We will be creating three threads that will all attempt to manipulate the same object. Each thread will output a single letter 100 times, and then increment that letter by one. The object we will be using is StringBuffer. We could synchronize on a String object, but strings cannot be modified once they are created, so we would not be able to increment the letter without generating a new String object. The final output should have 100 As, 100Bs, and 100 Cs all in unbroken lines.