Answers

Question and Answer:

  Home  Java Software Engineer

⟩ Tell us why do you need to use synchronized methods or blocks?

If threads are being used and a number of threads have to go through a synchronized section of code, only one of them may be executed at a time. This is used to make sure shared variables are not updated by multiple threads.

 165 views

More Questions for you: