the general form of synchronized block is
class table
{
.......
void printTable(int n)
{
synchronized(obj)
{
......
}
}
}
Here obj means object of table class or object of any class.
1)If we write this in place of obj we get lock on the object of table class.
That means we can’t access the synchronized block simultaneously by same object of table class.
2) But if write other object’s name other than table class in place of obj,what it means?
Then which object can’t access the synchronized block simultaneously?