Java Thread yield() methodThe yield() method of thread class causes the currently executing thread object to temporarily pause and allow other threads to execute. SyntaxReturnThis method does not return any value. ExampleTest it NowOutput: 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
Next TopicMultithreading Java
|