1) "last but not the least, the dead thread can be restarted
by creating an instance of Thread and passing the dead object as
the target to the constructor. Remember this may/may not be prudent
especially when your class has some computed state information. "
is this right please varify this with an example
2)Each object has only one lock. Therefore, if an object has three
synchronized methods, a thread entering any of the methods will set
the lock. After that, no thread can enter any of the synchronized
methods until the first exits the method it was executing and frees
the lock."
2)A unique monitor is associated with every object that has a
synchronized method
the abpove 2 points seems contradicting to me b'coa according to second poiunt
if each object have its unique lock then at a time both the method can
be holding there own lock but second poiunt says that no thread can enter
any of the synchronized method until the first exits the mthod it was executing and frees
the lock."
now suppose we have a synchronized mthod fn()
and there are 2 different objects of the class in which fn() is
present ob1 and ob2 now both of these have there seperate monitors
then at a time kboth can execute there seperate fn()
but I think this is wrong according to the I point
ps anyone clear this thing to me with a good example ( preferably a
working program)
3) static methods can be synchronized, and static methods use the lock belonging to the class rather than a lock belonging to any particular object.
now what does this mean in context with the above arguement???
4) what is the difference b\w sleep(milliseond) and wait(millisecond)