Synchronization: Object vs Class level

In my last post I wrote about how synchronization can help making sure that multiple threads do not execute same block of code at the same time. I will take the concept of synchronization a little further here. Going back to previous example. public void test() { synchronized(this){ try { count++; Thread.sleep(1000); System.out.println(“Hello from Runnable:”+count); … Continue reading Synchronization: Object vs Class level