Home Segments Top Top Previous Next

12: Mainline

Another distinguishing feature of Java is that Java allows you to create multiple threads. Each thread is like a separate program in that a thread seems to run at the same time as other threads; in contrast, however, the threads in one program share the same memory.

By exploiting the thread feature, you can write programs in which one thread is working through complex statistical formulas, another thread is fetching data from a file, still another thread is transmitting data over a network, and yet another thread is updating a display. All these threads share your computer's time. Because no thread ever has to wait for another thread to finish a task, you can write programs that exhibit an extraordinarily responsive look and feel.