Synchronized vs. Unsynchronized Methods

Here is some example code, SyncThread.java, that demonstrates how to use synchronized methods and what might happen if you do not use synchronized methods. To run the SyncThread command line application, execute either:
java SyncThread sync
or
java SyncThread unsync
Which will either run the demo with synchronized methods or with unsynchronized methods.

[back]