Image Chapter 13 Self Test

1. Generics are important to Java because they enable the creation of code that is

A. Type-safe

B. Reusable

C. Reliable

D. All of the above

2. Can a primitive type be used as a type argument?

3. Show how to declare a class called FlightSched that takes two generic parameters.

4. Beginning with your answer to question 3, change FlightSched’s second type parameter 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 ...

Get Java, A Beginner's Guide, 5th Edition, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.