What is the primary role of the synchronized keyword in Java?

Last Updated :
Discuss
Comments

What is the primary role of the synchronized keyword in Java?

To guarantee that the method is executed by a single thread


To pause threads for a set period

To ensure that multiple threads are executed simultaneously

To prevent thread starvation

Share your thoughts in the comments