Homework 5
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, andObject, one would draw an arrow pointing fromIntegertoNumberand a second arrow pointing fromNumbertoObject, but there would be no need to show an arrow fromIntegerdirectly toObject. Using this diagramming convention, show the subtyping relation onList<?>,ArrayList<?>,List<Number>,ArrayList<Number>,List<Integer>, andArrayList<Integer>.Do exercise 16.3 on page 315-316. Assume that the interfaces are defined as follows:
interface I1 {}; interface I2 {};