O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13: Generics

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

D. All of the above

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

No, type arguments must be object types.

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

The solution is

Image

4. Beginning with your answer to question 3, change FlightSched’s second type parameter so that it must extend Thread.

The solution is

Image

5. Now, change FlightSched so that its second ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required