Chapter 20 Review Flashcards

1
Q

T or F

A generic and non-generic method can have the same method name

A

True. A generic method can be overloaded by a non-generic method of the same name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

All generic method declarations have a type-parameter section that immediately precedes the method name

A

False. The method type-parameter precedes the return type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A generic method can be declared only once in the type-parameter section but can appear more than once in the method’s parameter list.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Type-parameter names among different generic methods must be unique.

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The scope of a generic class’s type parameter is the entire class except its static members

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do generic methods and classes do?

A

Generics allow you to specify a single method or class to perform a function or related function on different types of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A type-parameter is delimited by what characters?

A

<> angle brackets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A generic method’s ______ can be used to specify the method’s argument types, to specify the method’s return type and to declare variables within the method.

A

type parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If a generic class in instantiated and no type is specified. What default type is used?

A

Raw Type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What comes before the type-parameter in a generic class definition?

A

class name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The syntax _____________ specifies that the upper bound of a wildcard is type T?

A

? extends T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Upperbound

A

The upper bound class in a hierarchy defines the super class for which all classes within the domain are subs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Lowerbound

A

The lower bound class in a hierarchy defines the sub class for which all classes in the domain are a super-class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Wildcard

A

A wildcard “?” is used in conjunction with the keyword ‘super’ or ‘extends’ to define an upper or lower bound domain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly