Ch.10 Object-Oriented Programming: Polymorphism and Interfaces
What is a concrete class?
A class that is used to initiate objects.
What is a functional interface?
An interface containing only one method
What are some characteristics of methods declared in an interface.
Implicitly public abstract, all fields are implicitly public, static and final.
What can an abstract class not do?
Initiate objects because they are incomplete, and do not provide implementations.
What is dynamic/late binding?
Method calls being resolved at execution time.
What can invoke a superclass variable?
Only methods declared in the superclass
How many superclasses can a subclass inherit, and how many interfaces may it implement.
Only one superclass, and implement more than one interface.
How do you declare a default method in an interface.
Place the keyword default before the methods return type, and provide a complete method body.
What does polymorphism allow you to do?
Process objects that share the same superclass as if they were all objects of the superclass.
If an interface declares constants they are typically ___________.
Public, static, and final
What does an interface do?
Specifies what operations are allowed, but not how they do them. It describes a set of methods than can be called on an object.
What is the purpose of an abstract class?
To provide an appropriate super class from which other classes can inherit and share a common design.
In what situation is polymorphism particularly effective.
When implementing layered software systems
When is an interface used instead of an abstract method?
When there is no default implementations to inherit.
Why is a private method implicitly final?
You cannot override them in a subclass
And abstract method must be in an _________ __________.
abstract class
Abstract superclass variables can hold references to objects of any __________ _________ derived from the _______ _________.
concrete class, super class
___________ and _____________ cannot be declared abstract.
constructors and static methods
A class declared _______ cannot be extended.
final
Methods that are declared static are implicitly _________.
final
What keyword does an interface begin with?
interface, and must be public
How many abstract methods does it does an abstract class usually have.
one or more