📜  同步块和同步方法示例之间的区别 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:22.297000             🧑  作者: Mango

代码示例1
Which is more preferred synchronization block or synchronization method?
Synchronized block is more preferred way because it doesn't lock the Object, synchronized methods lock the Object and if there are multiple synchronization blocks in the class, even though they are not related, it will stop them from execution and put them in wait state to get the lock on Object.16-Jan-2017