Hi can someone explain if the in the following code the synchronized code will restrict access to the threads. If yes how is it different from, if we have used \"this\" as a mon
The method you wrote will block only if two threads will invoke this method with the exact same msg object.
If you synchronize on this then it only one thread will be able to invoke the method at a given time.