Hi
Why would you use a synchronized block vs. synchronized method?
Synchronized block vs. synchronized method on Java
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 8, 2011, 10:30 AM EST
A synchronized method locks all of the method's code, so that only one thread can enter it at a time.
AartiRank #2,383 · 594 reputationPosted Nov 16, 2011, 11:01 PM EST