Submitted Questions

  • Synchronization in Java

    When We should use Synchronization in Java and when we should not?

    Yeswanth

    • Dec 6th, 2013

    If you want to allow only one thread at a time to access block of code or method then we will go for synchronization.

    Code
    1. public synchronized
    2. void singleProcess() {
    3. // Insert code here
    4. }