| Author |
methods and blocks can be synchronized
|
Saral Saxena
Ranch Hand
Joined: Apr 22, 2011
Posts: 200
|
|
Hi Folks ,
While going through and doing goggling on synchronization , I read that only methods and blocks can be synchronized and not variables and classes , please me what's the technical reason behind not keeping the variables and classes..!!
|
 |
Praveen Kumar M K
Ranch Hand
Joined: Jul 03, 2011
Posts: 148
|
|
Although I haven't thought about this before, I'll venture a simple guess
Synchronization, as the word suggests, is a behaviourial mechanism and since methods and blocks form the behavior of a class, thats where synchronization has to be applied. Look at it from this perspective - variables form the current state of a class instance, and methods are the pieces of code which change this state(or behave differently). So it makes sense to only synchronize(a verb) methods/blocks.
|
 |
 |
|
|
subject: methods and blocks can be synchronized
|
|
|