Defining an abstract class Flashcards

1
Q

Give a characteristic of abstract classes !

A

A characteristic if an abstract class is that it is not required to include any abstract methods

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

Give a characteristic of abstract methods !

A

An abstract method can only be defined in an abstract class or an interface

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

Give a pitfall of abstract methods !

A

Abstract methods for which a body is provided don’t compile

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

Can an abstract class contain non abstract methods ?

A

An abstract class can contain non abstract methods

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

Give one criteria that the declaration of an abstract class has to satisfy in order to not have a compilation error ?

A

An abstract class can not be declared as final because an abstract class is by definition a class that must be extended to be instantiated

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

Same question for an abstract method!

A

An abstract can not be declared as final because by definition an abstract method must be overridden

An abstract method can not be declared as private because by definition an abstract method must be overridden

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

Give a second criteria that the declaration of an abstract method has to satisfy on order to not have a compilation error ?

A

An abstract method can not be declared as private because by definition an abstract method must be overridden

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