1. After pausing the current thread with sleep (), other threads get an execution opportunity, but after the call to yield (), only threads with the same priority or higher priority as the current thread can get the chance to execute.
2. Using sleep () causes the thread to go into a blocking state, after which the thread can continue to execute after the blocking time has elapsed, but using yield () only forces the current thread into a ready state, and the current thread is immediately given an execution opportunity after it is possible to call yield ().
3. Using sleep () requires catching exceptions, but using yield () does not require snapping.
4.sleep () has better portability than yield () and generally does not recommend yield () for multithreading concurrency control.
The difference between sleep () and yield () in a Java multi-thread