up previous next contents
Next: Creating a threaded class Up: Threads Previous: Thread states   Contents

Creating a threaded class with thread

  • Extend the java.lang.Thread class and override its run() method.
  • The run() method defines the behavior of the thread while it is running.
  • When the run() method ends, the thread goes into the dead state.
  • As a developer, you call the start() method of the thread; the JVM calls the run() method.
  • Never call the run() method directly.


up previous next contents
Next: Creating a threaded class Up: Threads Previous: Thread states   Contents