CPE 101 Assignment 5
Read Chapter 11 and do the following exercises.
- What is a cloneable class? Download the zip
file clone.zip and run the CloneTest demo program
with its associated Point class. Notice that setting
r = p makes them refer to the same instance. Changing r is the same as
changing p. Are the hashcodes of p and r the same? Note that
unless a class implements the Cloneable interface, the clone method will
throw an exception. Remove the comment in front of implements Cloneable. How does
the output change? Point q is now a clone of Point p. Do they have the
same hash codes?
- Do exercises 11.4 - 11.7 inclusive.
- Do one of 11.8 through 11.11.
- Do exercise 11.12
- Do exercises 11.14 and 11.16
- Do exercise 11.18
- Modify Fig 11.26 to allow items to be moved (rather than
copied) from the left list to the right list and back again. The
example below shows a suitable GUI. This happens to be an applet.
You will be doing an application.
Maintained by John Loomis,
last updated 22 Sept 2005