The synchronized key word is used to avoid deadlock condition. If two threads are trying to access the same method, only one thread is allowed into the method. The second thread has to wait until the first thread completes the execution of the Synchronized method.