CH. 9

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

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

UML diagrams

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

a chain of inheritance.

All fields declared in an interface

are treated as final and static

When one object is a specialized version of another object, there is this type of relationship between them.

"is a"

In a class hierarchy,

the more general classes are toward the right of the tree and the more specialized classes are toward the left. - wrong

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.

Which of the following statements correctly specifies two interfaces?

public class ClassA implements [Interface1, Interface2] - wrong public class ClassA implements (Interface1, Interface2) - wrong

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

public class Salaried implements PayType - wrong

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

super - wrong

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

true

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

package - wrong

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

final

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

instanceof

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

true

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

true

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

ClassA

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

* - wrong # ?

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

extends

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

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.

static ?

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

Object

All methods specified by an interface are

public

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

public - wrong

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.

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.

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

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.

true

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 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

This shows the inheritance relationships among classes in a manner that is similar to a family tree.

flowchart ?

In the following statement, which is the superclass? public class ClassA extends Class B implements ClassC

ClassC - wrong


Ensembles d'études connexes

Protection- Pressure ulcers, Allergies, HIV

View Set

Combo with "Essentials of Economics (Schiller) - Chapter 8" and 1 other

View Set

Ch. 10 Quality Management & Six Sigma

View Set

Overview of The Insurance Industry

View Set

The electromagnetic Spectrum Quiz #2

View Set