Java 2 chapter 9 review study
Employing inheritance reduces errors because _________________.
many of the methods a subclass needs have already been used and tested
A base class can also be called a _________________.
superclass
Which of the following choices is the best example of a parent class/child class relationship?
BodyOfWater/River
A class named Building has a public, nonstatic method named getFloors(). If School is a child class of Building, and modelHigh is an object of type School, which of the following statements is valid?
modelHigh.getFloors();
When a subclass method has the same name and argument types as a superclass method, the subclass method _________________ the superclass method.
overrides
When you instantiate an object that is a member of a subclass, the _________________ constructor executes first.
parent class
If the only constructor in a superclass requires arguments, its subclass _________________.
must contain a constructor
A child class Motorcycle extends a parent class Vehicle. Each class constructor requires one String argument. The Motorcycle class constructor can call the Vehicle class constructor with the statement _________________.
super("Suzuki");
If you create a data field or method that is _________________, it can be used within its own class or in any classes extended from that class.
public or protected
You use a _________________ method access specifier when you create methods for which you want to prevent overriding in extended classes.
final
When a parent class contains a static method, child classes _________________ override it.
cannot
Abstract classes differ from other classes in that you _________________.
cannot instantiate objects from them
An abstract class Dwelling has two subclasses, SingleFamily and MultiFamily. None of the constructors for these classes requires any arguments. Which of the following statements is legal?
SingleFamily myHome = new SingleFamily();
An abstract class Employee has two subclasses, Permanent and Temporary. The Employee class contains an abstract method named setType(). Before you can instantiate Permanent and Temporary objects, which of the following statements must be true?
You must code statements for the setType() method within both the Permanent and Temporary classes
Which of the following statements is true?
Superclasses can contain abstract methods
When you create a _________________ in Java, you create a variable name in which you can hold the memory address of an object
reference
An application's ability to select the correct subclass method to execute is known as _________________ method binding.
dynamic
You _________________ override the toString() method in any class you create.
can
The Object class equals() method takes _________________.
one argument
The alternative to multiple inheritance in Java is known as a(n) _________________.
interface