Java Reference
In-Depth Information
Exercise 10.70 Challenge exercise Sometimes class/interface pairs exist in the Java standard
library that define exactly the same methods. Often, the interface name ends with Listener and
the class name with Adapter. An example is PrintJobListener and PrintJobAdapter .
The interface defines some method headers, and the adapter class defines the same methods,
each with an empty method body. What might the reason be for having them both?
Exercise 10.71 The collection library has a class named TreeSet , which is an example of
a sorted set. Elements in this set are kept in order. Carefully read the description of this class,
and then write a class Person that can be inserted into a TreeSet , which will then sort the
Person objects by age.
Exercise 10.72 Use the API documentation for the AbstractList class to write a con-
crete class that maintains an unmodifiable list.
Search WWH ::

Custom Search