Thread Safety is very important factor when implementing multithreaded applications. Code Synchronization helps in preventing multiple threads to access same code at a given time. This tutorial explains how Code synchronization works and explains how Object Locks work with multiple threads.
Video source: http://java9s.com/core-java/thread-safety-and-code-synchronization-in-java