Copyright © 2001 Qusay H. Mahmoud
17
Synchronization
lMutual Exclusion (preventing simultaneous access to shared data) can be accomplished using the synchronized access specifier
–synchronized boolean withdraw(int amount) {
–   ….
–}
–Or using the synchronized block:
–boolean withdraw(int amount) {
–    synchronized(this {
–       ….
–    }
–}