sleep() and yield() Methods

Q

What is the difference between yielding and sleeping?

✍: FYIcenter

A

When a thread invokes its yield() method, it returns to the ready state. When a thread invokes its sleep() method, it returns to the waiting state.

2007-03-03, 5665👍, 0💬