Absract Classes and Interfaces Flashcards

1
Q

What is an abstract class?

A

An abstract class is:

  1. A special type of class that cannot be instantiated.
  2. It contains at least 1 abstract method and can contain concrete methods.
  3. It is “contract-based”. Abstract methods MUST be overridden in the subclass.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an interface?

A

An interface is:

  1. A special type of class that cannot be instantiated
  2. It specifies what a class does, but not how it implements it.
  3. It lacks instance variables.
  4. It is characterized by behavior.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is inheritance between classes and interfaces?

A

Classes can inherit interfaces; from 0 to many.

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

How is inheritance between an interface to another interface?

A

Interfaces can extend other interfaces; from 0 to many.

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