First thing i think i should say is that i am not looking for a solution , this is hwk , but it runs correctly , what would help me greatly is come clarification..
Thread calls notifyAll upon termination in support of the join functionality. This is documented in the Javadoc for Thread#join:
This implementation uses a loop of
this.waitcalls conditioned onthis.isAlive. As a thread terminates thethis.notifyAllmethod is invoked. It is recommended that applications not usewait,notify, ornotifyAllonThreadinstances.
There are essentially two conclusions then:
join.wait otherwise, do not use a Thread instance as a monitor.