Chapter 1

Programming Threads

IN THIS CHAPTER

check Examining threads

check Creating threads from the Thread class

check Working with the Runnable interface

check Creating threads that cooperate

check Executing threads

check Making methods cooperate

check Using a lock

check Interrupting threads

Have you ever seen a plate-spinning act, in which a performer spins plates or bowls on top of poles, keeping multiple plates spinning at the same time, running from pole to pole to give each plate a little nudge — just enough to keep it going? The world record is 108 plates kept simultaneously spinning.

In Java, threads are the equivalent of plate spinning. Threads let you divide the work of an application into separate pieces, all of which ...

Get Java All-in-One For Dummies, 6th Edition 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.