What is the difference between yielding and sleeping? - The sleep() causes the thread to suspend its running only for a specified amount of time. - The yield() causes the thread to join the ready queue in the CPU again. When a thread is created and started, what is its initial state? After a thread has been started, it could be in runnable, blocked, waiting, timed waiting or even terminated state. What are the high-level thread states? The high-level thread states are ready, running, waiting, and dead.
|
27 Java Multithreading Interview Questions and AnswersJava multithreading interview questions and answers for both freshers and experienced - Process and Thread, Daemon thread, Preemptive scheduling vs. time slicing, max-priority, min-priority and normal-priority level, priority for Garbage collector thread...