Exercise 15.x1: One can show the subtype relation on Java types by
drawing a diagram with arrows, where each arrow points from a subtype
to one of its supertypes. Arrows can be omitted that are implied by transitivity. As a simple example, if
the types under consideration are Integer
, Number
, and Object
,
one would draw an arrow pointing from Integer
to
Number
and a second arrow pointing from
Number
to Object
, but there would be no
need to show an arrow from Integer
directly to
Object
. Using this diagramming convention, show the
subtyping relation on List<?>
,
ArrayList<?>
,
List<Number>
, ArrayList<Number>
,
List<Integer>
, and ArrayList<Integer>
.
Do exercise 16.3 on page 318. Assume that the interfaces are defined as follows:
interface I1 {}; interface I2 {};