Java Reference
In-Depth Information
4 . Beginning with your answer to question 3, change FlightSched 's second type para-
meter so that it must extend Thread .
5 . Now, change FlightSched so that its second type parameter must be a subclass of its
first type parameter.
6 . As it relates to generics, what is the ? and what does it do?
7 . Can the wildcard argument be bounded?
8 . A generic method called MyGen( ) has one type parameter. Furthermore, MyGen( )
has one parameter whose type is that of the type parameter. It also returns an object
of that type parameter. Show how to declare MyGen( ) .
9 . Given this generic interface
show the declaration of a class called MyClass that implements IGenIF .
10 . Given a generic class called Counter<T> , show how to create an object of its raw
type.
11 . Do type parameters exist at run time?
12 . Convert your solution to question 10 of the Self Test for Chapter 9 so that it is gener-
ic. In the process, create a stack interface called IGenStack that generically defines
the operations push( ) and pop( ) .
13 . What is < > ?
14 . How can the following be simplified?
Search WWH ::




Custom Search