The Thread Class

The Java java.lang.Thread class describes the required behavior of Thread objects. Thread objects are used to encapsulate and conceal the details of a particular operating system's approach to multithreading. The JVM creates and runs several threads to support even the simplest Java program. The threads are used to load class files, interpret operating system events, and start the execution of your program.

The Life of a Thread

Thread objects have a distinct lifecycle with four basic states: new, runnable, blocked, and dead (as shown in Figure 10.1). The transitions from new to runnable and from runnable to dead are simple and permanent; the transition between runnable and blocked occupies most of the Java programmer's attention. ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) 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.