Answers to Self-Review Exercises

20.1

a) False. Generic and nongeneric methods can have the same method name. A generic method can overload another generic method with the same method name but different method parameters. A generic method also can be overloaded by providing nongeneric methods with the same method name and number of arguments.

b) False. All generic method declarations have a type-parameter section that immediately precedes the method’s return type.

c) True.

d) True.

e) False. Type-parameter names among different generic methods need not be unique.

f) True.

20.2

a) Generic methods, generic classes.

b) angle brackets (< and >).

c) type parameters.

d) a raw type.

e) type-parameter section.

f) ? extends T.

Get Java™ How To Program (Early Objects), Tenth 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.