|
There are two ways of creating a thread:
- Using a class that extends the Thread class
- Using a class that implements the Runnable interface (note that
Thread
implements Runnable)
You start a thread by calling Thread's start()
method from some thread. The start()
method does the following:
- Creates a separate thread of execution
- Starts that thread of execution at the Thread's or Runnable's run() method
- Returns from the start()
call in the starting thread.
|