Generics Flashcards

1
Q

What are Generics in java?

A

It is a feature that allows us pass TYPES to methods, classes and interfaces.

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

What are the beneficts of generics?

A

1 - Remove the need for casting

2 - Get safer code with errors being spoted in compile time instead of runtime.

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

How is called the type passed between the diamonds?

A

Parametarized Type

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

What are Bounded Types?

A

Bounded types are used when we want to restrict which types may be passed to an interface, class or method

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