What are the ways to create a 'Thread'?There are two ways to create a thread:
1. A thread can be created extending from the 'Thread' class. 2. The second way of creating thread is by implementing the 'Runnable interface'.
- For implementing the runnable interface run() method is used.
- 'Thread' class provides the constructors and methods to create and perform the operations on a thread.
- 'Thread' class extends object class and implements the 'runnable interface'.
|