Tuesday, November 29, 2011

Core Java Interview Questions :Why would you use a synchronized block vs. synchronized method?

Synchronized blocks place locks for shorter periods than synchronized methods.:I guess, synchronized block or synchronized methods are depends on the user requirements. :First of all to achieve Multithreading mechanism in java we should go for synchronization. And this can be done in two ways depending on the requirement. :There is not a clear advantage of using synchronized method over block.:in some times only some part of the method doesn&

No comments:

Post a Comment