Synchronized block in java
Synchronized block: Synchronized block is used to synchronize a critical block of code instead of whole method. Note: Synchronized block is preferred over synchronized method because in case synchronized block only critical block of code is locked not whole method, hence performance will be better in this case. Throw NullPointerException if object passed in synchronized … Read more