Chapter 19: Threads

The exercises here are taken from my forthcoming book The Java Developer's Resource.


  1. What's the difference between a thread created as a subclass of java.lang.Thread and one created as an implementation of Runnable?
  2. Why should synchronized blocks of code call wait()?


  1. Add a Color property to the balls.
  2. The balls in Program 19.10 always move in forty-five degree angles. Allow a broader behavior of the balls.
  3. Write a multiball applet where the number of balls is a PARAM that is defined in HTML. You'll probably need to store the balls in a Vector. You should also allow the size, color, starting positions and directions of each ball to be given in a PARAM.
  4. Hard: Allow the balls to bounce off each other as well as the walls.

[ Exercises | Cafe Au Lait | Books | Trade Shows | Links | FAQ | Tutorial | User Groups ]

Copyright 1996 Elliotte Rusty Harold
Last Modified August 20, 1996