What are the ways to create a thread?

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'.
Preemptive scheduling vs. time slicing
Preemptive scheduling vs. time slicing - Preemptive scheduling ensures the highest priority thread to execute until it enters the waiting or dead states..
What is a daemon threads?
What is a daemon threads? - Daemon threads run at a low priority. The GC is an example of such thread....
Arraylist vs. Vector
Arraylist vs. Vector - Arraylist's methods are not synchronized which means they are not thread safe. Vector's methods are....
Post your comment