June 2018
Intermediate to advanced
408 pages
11h 23m
English
In multithreaded applications, there might be situations where multiple threads try to access a shared resource and produce erroneous and unexpected results. We need to ensure that the resource will be used by only one thread at a time, and that can be achieved by synchronization. The synchronized keyword is used to achieve synchronization; when we define any synchronized block in Java, only one thread can access that block and other threads are blocked until the thread inside the block exits that block.
The synchronized keyword can be used with the following different types of blocks:
In Java, a synchronized block ...
Read now
Unlock full access