7.2. Multi-threading in Java
Java, like many modern programming languages, includes support for multi-threaded applications. In Java, threads of execution are represented by the java. lang.Thread class, while code for tasks that are designed to run in a separate thread is represented by the java.lang.Runnable interface. It is very important that developers be aware of both.
7.2.1. Creating Multi-threaded Applications with the Thread Class
The java.lang.Thread class provides methods to start, suspend, resume, and stop a thread, as well as to control other aspects such as the priority of a thread or the name associated with it. The simplest way to use the Thread class is to extend it and override the run() method, which is invoked when the thread ...
Get Java™ Network Programming and Distributed Computing 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.