If an exception is thrown inside a synchronized block or method, the JVM automatically releases the monitor lock held by the current thread as it exits the block, whether that exit happens normally or via an exception.
If a synchronized transferFunds() method throws an exception halfway through updating two account balances, the lock on the account object is released immediately as the exception propagates, so other threads aren't blocked — though the transfer logic itself may need additional safeguards to avoid leaving balances inconsistent.
A concise interview answer is
When an exception occurs inside a synchronized block, the JVM automatically releases the lock as part of exiting the block, exactly like an implicit finally — so other threads aren't blocked forever. The exception still propagates normally; only the lock management is handled for you, not the resulting shared-state consistency.
Last updated: 16 July 2026
Previous question: What is the difference between synchronized and ReentrantLock?
Next question: How do you get a thread dump in Java?