Quiz 7

¡Supera tus tareas y exámenes ahora con Quizwiz!

What does a derived class automatically inherit from the base class?

All of the above

The following statement creates an array of three Animal references.

Animal[] ref = new Animal[3];

The keyword extends indicates polymorphism.

False

When you create a class that uses an interface, you include the keyword extends.

False

When you define a derived class, you give only the added instance variables and the added methods as well as all the methods from the base class

False

When you define a derived class, you give only the added instance variables and the added methods as well as all the methods from the base class.

False

The class __________ is an ancestor class of all Java classes.

Object

If the final modifier is added to the definition of a method, this means:

The method may not be redefined in the derived class.

A derived class is a class defined by adding instance variables and methods to an existing class.

True

Overriding is when a derived class redefines a method from the base class.

True

Private methods of the base class are not available for use by derived classes.

True

A super class is also called a

base class

When you create a new subclass in Java, neither the superclass source code nor the superclass _____ is changed.

bytecode

Inheritance is the process by which a new class - known as a _________ - is created from another class, called the _____________.

derived class, base class

If Java did not allow you to ____ classes, you would need to create every part of a program from scratch.

extend

In using the keyword this in place of super(), the invocation of this must be the ___________ action taken by the constructor.

first

When a class both extends and implements, by convention the ____ clause is last in the class header.

implements

When you assign a variable or constant of one type to a variable of another type, the behavior is called ____.

implicit conversion

The keyword extends indicates:

inheritance

Instead of using the automatic toString() method with your classes, it is usually more useful to write your own ____ version of the toString() method that displays some or all of the data field values for the object with which you use it.

overloaded

A(n) ____ is not an object, but it points to a memory address.

reference

Inheritance promotes code _____.

reuse

A derived class is also called a

sub class

The special syntax for invoking a constructor of the base class is:

super()

The Object class ____ method converts an Object into a String that contains information about the Object.

toString()

You may substitute the keyword this for super() to call a constructor of the derived class.

True

A(n) ____ class is one from which you cannot create any concrete objects, but from which you can inherit.

abstract

An object of a derived class has the type of the derived class, and it also has the type of the base class, and more generally, has the type of every one of its ________ classes.

ancestor


Conjuntos de estudio relacionados

IM EOR - GI Conditions Part 1 (Celiac Dz/IBD/GERD/PUD/Hernias)

View Set

Chptr 21 The Birth of Stars and the Discovery of Planets outside the Solar System

View Set

EMT Chapter 7 - Life Span Development

View Set

4.4 Guided Reading Maritime Empires Link Regions

View Set

Path Analysis and Structural Equation Model (SEM)

View Set

Surface Area and Volume for Spheres

View Set

A&P 2, Unit 2, Chapter 21 Homework

View Set

Covalent Modifications Involved in the Secretory Pathway

View Set