Mr. Brewer's Java: Ch. 11 Review Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

both of the above

Abstract classes can contain _________. a) abstract methods b) nonabstract methods

cannot instantiate objects from them

Abstract classes differ from other classes in that you _________.

inherit from one abstract superclass at most

In Java, a class can _________.

one

Java subclasses have the ability to inherit from _________ parent class(es).

You must code statements for the setType() method within both the Permanent and Temporary classes.

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? 1) You must code statements for the setType() method within the Permanent class. 2) You must code statements for the setType() method within both the Permanent and Temporary classes. 3) You must not code statements for the setType() method within either the Permanent or Temporary class. 4) You can code statements for the setType() method within the Permanent class or the Temporary class, but not both.)

NonPerishable myProduct = new NonPerishable();

An abstract class Product has two subclasses, Perishable and NonPerishable. None of the constructors for these classes requires any arguments. How do you declare a NonPerishable object called myProduct?

dynamic

An application's ability to select the correct subclass method to execute is known as _________ method binding.

anotherThing is the same type as thing

Assume the following statement appears in a working Java program: if(thing.equals(anotherThing)) x = 1; You know that _________.

less specific

Parent classes are _________ than their child classes.

memory address

The Object class equals() method considers two object references to be equal if they have the same _________.

one argument

The Object class equals() method takes _________.

interface

The alternative to multiple inheritance in Java is known as a(n) _________.

reference

When you create a _________ in Java, you create a variable name in which you can hold the memory address of an object.

implements

When you create a class that uses an interface, you include the keyword _________ and the interface's name in the class header.

is a

When you create a superclass and one or more subclasses, each object of the subclass _________ superclass object.

abstract class

When you want to provide some data or methods that subclasses can inherit, but you want the subclasses to override some specific methods, you should write a(n) _________.

Superclasses can contain abstract methods.

Which of the following statements is true? 1) Superclass objects are members of their subclass. 2) Superclasses can contain abstract methods. 3) You can create an abstract class object using the new operator. 4) An abstract class cannot contain an abstract method.

Currency[] currencyref = new Currency[5];

Which statement creates an array, called currencyref, of five references to an abstract class named Currency?

can

You _________ override the toString() method in any class you create.

neither a nor b

You can instantiate concrete objects from a(n) _________. a. abstract class b. interface


Ensembles d'études connexes

OM - Ch.6 - Manufacturing Processes

View Set

Chapter 2 Quiz - Social Investigation

View Set

World Geography Chapter 1, Section 3 The Branches of Geography

View Set

Coronary Artery Disease & Acute Coronary Syndrome (Lewis Med-Surg CH. 33)

View Set