Chapter 19: Threads
The exercises here are taken from my forthcoming book
The Java Developer's Resource.
Quiz
- What's the difference between a thread created as a subclass of java.lang.Thread and one created as an implementation of Runnable?
- Why should synchronized blocks of code call wait()?
Exercises
- Add a Color property to the balls.
- The balls in Program 19.10 always move in forty-five degree angles. Allow a broader behavior of the balls.
- 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.
- 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
elharo@sunsite.unc.edu
Last Modified August 20, 1996