Java Threads Question: Download Questions PDF
What are three ways in which a thread can enter the waiting state?
Or
What are different ways in which a thread can enter the waiting state?
Answer:
A thread can enter the waiting state by the following ways:
1. Invoking its sleep() method,
2. By blocking on I/O
3. By unsuccessfully attempting to acquire an object's lock
4. By invoking an object's wait() method.
5. It can also enter the waiting state by invoking its (deprecated) suspend() method.
1. Invoking its sleep() method,
2. By blocking on I/O
3. By unsuccessfully attempting to acquire an object's lock
4. By invoking an object's wait() method.
5. It can also enter the waiting state by invoking its (deprecated) suspend() method.
Download Java Threads Interview Questions And Answers
PDF
Previous Question | Next Question |
How do I create a Runnable with inheritance? | What is the difference between yielding and sleeping? |