Join usage: Join is a non-static method
Thread Threada and THREADB, running simultaneously
1, if the Threada call their own join method, then Threada is blocked, even if the threadb end, Threada will not unblock. Threada jams Threada until Threada ends, deadlocks occur
2. If you call the Join (3000) method in Threada, the Threada is blocked by 3000ms and then run. Threada plug Threada 3000ms,
3, if the THREADB join method is called in Threada, the same Threada is blocked until threadb ends and Threada begins to run. THREADB Jam Threada until threadb ends
4, if in Threada call THREADB's Join (3000) method, Threada is also blocked 3000ms//threadb blocked Threada 3000ms
Sleep usage: Sleep is a static method
Block the current thread for a period of time so that other threads can continue to execute. However, it does not release the object lock, and if it is in the synchronized synchronization block, other threads still cannot access the shared data.
Use of Yield:
Yield usage is similar to sleep, except that it is not possible to specify the time of the blockage and only allow threads of the same priority to have the opportunity.
Join Sleep yield