Question:

What is the difference between a synchronized method and a synchronized block ?

Answer:

In Java programming, each object has a lock. A thread can acquire the lock for an object by using the synchronized keyword. The synchronized keyword can be applied in a method level (coarse grained lock) or block level of code (fine grained lock).


Keywords:

© 2017 QuizBucket.org