Originally posted by Armel Moukoss:
...I thought that after writting b.start(); the code within the run() method will be excuted. But it's excuted only later in synchronized. why? ...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
SCJP-1.5<br />SCWCD-1.4
Originally posted by chintan ramavat:
after the flow hits the wait() method where it releases the lock and goes back to runnable state where it waits until somebody notifies it
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
At least with the JRE from Sun, notify() is used internally. Whenever a thread dies, it does a notifyAll() on itself. This is the reason why you don't see a deadlock.Originally posted by Armel Moukoss:
I have another question if i delete the notify() method in class ThreadB i have the same result. I thought that without notify in class ThreadB, the class ThreadA will still wait. ThreadA complete his synchronized code without any problems.
Do you have any answer for this question ? Thank you.
Armel