Question: Why do we need locks in Java? To prevent race conditions To allow threads to share information To ensure one thread doesn't starve the other
Why do we need locks in Java?
To prevent race conditions
To allow threads to share information
To ensure one thread doesn't starve the other threads out of CPU time
To ensure data can't be modified by other threads even if it is accessed.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
