Java Multithreading Question and Answers
17. | What methods must be implemented by all threads? |
---|---|
All tasks must implement the run() method, whether they are a subclass of Thread or implement the Runnable interface. | |
18. | How can multiple threads be controlled simultaneously? |
---|---|
If you create threads in a ThreadGroup object, they may be controlled simultaneously with the member function of said object. | |
19. | What is the class and interface in java to create thread and which is the most advantageous method? |
---|---|
Thread class and Runnable interface can be used to create threads and using Runnable interface is the most advantageous method to create threads because we need not extend thread class here. | |
20. | What are the states associated in the thread? |
---|---|
Thread contains
|
|