Chapter 8, “Threads”

The run() method of Thread and Runnable provides the entry point for a separate thread of execution.

Java provides two approaches to creating threads: extending Thread and implementing Runnable.

In the first approach, you create a subclass of class Thread and override the run() method to provide an entry point into the thread's execution. When you create an instance of your Thread subclass, you invoke its start() method to cause the thread to execute as an independent sequence of instructions. This approach has the drawback of requiring your Thread objects to be under the Thread class in the class hierarchy.

Java's other approach to creating threads does not limit the location of your Thread objects within the class hierarchy. ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.