AbstractClasses Flashcards
1
Q
What is an abstract method?
A
Includes a definition but no implementation.
A method without a body must be declared abstract.
Class may also be abstract.
2
Q
What is an interface?
A
Contains only abstract methods, no fields.
Static fields OK.
Define behavior, but not implement it.
3
Q
How do you implement an interface?
A
Uses keyword implements instead of extends.
A concrete class that implements an
interface must provide an implementation of
all of the methods in the interface.
○ An abstract class does not need to.
● In Java, a class may only extend one other class, but may implement an unlimited number of interfaces