COSC 1437 CH9

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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

False

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

True

A subclass can directly access

only public and protected members of the superclass.

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

overrides

If you do not provide an access specifier for a class member, the class member is given ________ access by default.

package

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.

polymorphic

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

True

All fields declared in an interface

are treated as final and static.

All methods specified by an interface are

public

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

True

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

True

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

abstract method

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.

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

#

A protected member of a class may be directly accessed by

All of these

In the following statement, which is the subclass? public class ClassA extends ClassB implements ClassC

ClassA

In the following statement, which is the interface? public class ClassA extends ClassB implements ClassC

ClassC

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

False

If a subclass constructor does not explicitly call a superclass constructor,

Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes.

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

a chain of inheritance.

In a UML diagram, you show a realization relationship by connecting a class and an interface with a

dashed line that has an open arrowhead at one end.

This key word indicates that a class inherits from another class.

extends

In a class hierarchy,

the more general classes are toward the top of the tree and the more specialized classes are toward the bottom.

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

True

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

True

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

inheritance

You can use this operator to determine whether an object is an instance of a particular class.

instanceof

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

interface inheritance

Which of the following statements declares Salaried as a subclass of PayType?

public class Salaried extends PayType

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

True


संबंधित स्टडी सेट्स

STATS Ch.8, Applied Statistics Midterm 2

View Set

Possible Solutions to Climate Change

View Set

PUBLIC HEALTH INFORMATICS: AN INTRODUCTION

View Set

CompTIA Security+ Final Assessment (40)

View Set