educative.io

The wrong answer in the example for synchronized bloc

In the second example where we added a synchronize block and used this as a lock, it is said that such initialization is thread-safe. It is wrong because this will be a runnable object and different per each thread. You have to use a class object like Demonstration.class like it was described in the Superman problem topic. Am I right?


Course: https://www.educative.io/courses/java-multithreading-for-senior-engineering-interviews
Lesson: https://www.educative.io/courses/java-multithreading-for-senior-engineering-interviews/atomicreference