Unit Exercises
- Create a class called Battery containing an int that is a battery number (as a unique identifier). Make it cloneable and give it a toString( ) method. Now create a class called Toy that contains an array of Battery and a toString( ) that prints out all the batteries that it uses. Write a clone( ) for Toy that automatically clones all of its Battery objects. Test this by cloning Toy and printing the result.
- Try to implement the race condition based on Examples 3-2 and 3-3 in Chapter 3: Race Conditions and Mutual Exclusion of High-Performance Java Platform Computing (Christopher & Thiruvathukal, 2000).
- Try to implement the Dining Philosophers problem based on Examples 3-13, 3-19, 3-20, and 3-21 in Chapter 3: Race Conditions and Mutual Exclusion of High-Performance Java Platform Computing (Christopher & Thiruvathukal, 2000).
Updated August 05 2020 by FST Course Production Staff