Originally posted by Andrea Z�rcher:
...1) Is true. When multi-threaded code isn�t correctly synchronised, non-deterministic and unexpected behaviour can occur...
Yes, but I think the question is
how synchronization might change this.
When multiple Java threads are running, it's up to the thread scheduler to determine when each thread will get a chance to run. This can result in somewhat unpredictable behavior. Synchronized code requires a thread to get the lock before proceeding, so this can force threads to wait if another thread has the lock.