Javatpoint Logo
Javatpoint Logo

Java Thread yield() method

The yield() method of thread class causes the currently executing thread object to temporarily pause and allow other threads to execute.

Syntax

Return

This method does not return any value.

Example

Test it Now

Output:

main in control
main in control
main in control
Thread-0 in control
Thread-0 in control
Thread-0 in control
Thread-1 in control
Thread-1 in control
Thread-1 in control






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA