What is the difference between yielding and sleeping?
Answer / Raj Bhushan Rai
Yielding in Java is a method used by a running thread to voluntarily give up its CPU time, allowing another thread of the same or lower priority to execute. Sleeping, on the other hand, causes the current thread to pause execution for a specific amount of time before it continues running. The key difference between yielding and sleeping is that yielding allows for cooperative multitasking while sleeping does not.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the purpose of a statement block?
How to change the priority of thread or how to set priority of thread?
what is the output ? Math.floor(-2.1) a)2 b)-2 c)-3.0 d)0
When to use runnable interface vs thread class in java?
What is the advantage of preparedstatement over statement?
How can we create objects if we make the constructor private ?
What is fail fast in java?
What is array list in java?
Why should we create an object? what is a need of it? Apart from access members of a class i want what is a need of object what does it contain?? In normal class to access any member of thaht class we create object where as for static class we access its members using class name. what is a difference between them... thanks in advance.
How do you check if a string is lexicographically in java?
What one should take care of, while serializing the object?
Can we have static methods in an interface?