Skip to main content
Defining, Instantiating, and Starting Threads
- Threads can be created by extending Thread and overriding the public void run() method.
- Thread objects can also be created by calling the Thread constructor
that takes a Runnable argument. The Runnable object is said to be the
target of the thread.
- You can call start() on a Thread object only once. If start() is
called more than once on a Thread object, it will throw a
RuntimeException.
- It is legal to create many Thread objects using the same Runnable object as the target.
- When a Thread object is created, it does not become a thread of
execution until its start() method is invoked. When a Thread object
exists but hasn't been started, it is in the new state and is not
considered alive.