Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

difference between synchronized block and synchronized method example

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
 
PREVIOUS NEXT
Tagged: #difference #synchronized #block #synchronized #method
ADD COMMENT
Topic
Name
3+8 =