Java example - unsynchronized threads
The applet starts two threads, a producer and a consumer,
which share an object which holds one integer. The producer
increments the shared integer and sleeps for a random
amount of time. The consumer retrieves the object and sleeps
for a random amount of time.
The source