15. Using Threads

Threading is the way in which a software application carries on multiple processes at the same time. A thread in Java is a unit of program execution that runs concurrently with other threads.

Threads are commonly used in GUI applications. In a GUI application, one thread might be listening for input from the keyboard or other input devices, while another thread is processing the previous command. Networking is another common area in which you will find multithreading used. In network programming, one thread might be listening for connection requests, while another thread processes a previous request. Timers are also common uses of threads. A timer can be started as a thread running independently from the rest of an application. ...

Get Java™ Phrasebook 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.