Inheritance and Polymorphism

Ace your homework & exams now with Quizwiz!

True

An abstract class is not instantiated itself but serves as a superclass for other classes.

a chain of inheritance

If ClassC is derived from ClassB which is derived from ClassA, this would be an example of

overrides

If a method in a subclass has the same signature as a method in the superclass, the subclass method ________ the superclass method.

False

If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method.

extends

Which key word indicates that a class inherits from another class?

instanceOf

Which of the following is the operator used to determine whether an object is an instance of a particular class?

class hierarchy

Which of the following shows the inheritance relationships among classes in a manner similar to that of a family tree?

True

You can write a super statement that calls a superclass constructor but only in the subclass's constructor.

package

If you don't provide an access specifier for a class member, the class member is given ________ access by default

True

When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.

True

When an "is a" relationship exists between objects, it means that the specialized object has all the characteristics of the general object plus additional characteristics that make it special.

False

You show inheritance in a UML diagram by connecting two classes with a line that has an open arrowhead pointing to the subclass.

public

All methods specified by an interface are _____.

False

In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

Object

When a class does not use the extends key word to inherit from another class, Java automatically extends it from the ________ class.

protected

A ________ member's access is somewhere between public and private.

abstract

A class becomes abstract when you place the ________ key word in the class definition.

abstract

A(n) ________ method is a method that appears in a superclass but expects to be overridden in a subclass.

True

Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.

True

Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.

before

If a subclass constructor does not explicitly call a superclass constructor, Java will automatically call the superclass's default constructor just ______ the code in the subclass's constructor executes.

#

Protected class members can be denoted in a UML diagram with the ________ symbol.

are treated as final and static.

All fields declared in an interface...

"is a"

What type of relationship exists between two objects when one object is a specialized version of another object?

True

When a class contains an abstract method, you cannot create an instance of the class.

final

When a method is declared with the ________ modifier, it cannot be overridden in a subclass.

polymorphic

In Java, a reference variable is ________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.

a hierarchy chart

In ________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.

inheritance

In object-oriented programming, ________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

interface

When a class implements an interface, an inheritance relationship known as ________ inheritance is established.


Related study sets

APCS A EVERYTHING YOU NEED TO KNOW

View Set

Fund A Lecture 9: RNA & Protein Synthesis

View Set

Chapter 7 Legal Dimensions of Nursing Practice

View Set

1.6 Real Estate The Business of Value

View Set

Chapter 5-Disability Income and Related Insurance ExamFx quizzes

View Set

Chapter 5 - Arrests and seizures without warrants

View Set

Chapter 39: Assessment and Management of Patients With Rheumatic Disorders

View Set