A simple Java program with synchronized threads