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? 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. What is the difference between yielding and sleeping? When a task invokes its yield() method, it returns to the ready state, either from waiting, running or after its creation. When a task invokes its sleep() method, it returns to the waiting state from a running state. How to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or Extending Thread class or implementing Runnable Interface. Which is better? You have two ways to do so. First, making you
About Java and it's related concepts..