CISP 1020 Ch. 9

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

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

"is a"

Which of the following is true about protected access?

Protected members may be accessed by methods in the same package or in a subclass, even when the subclass is in a different package.

A subclass can directly access ________.

only public and protected members of the superclass

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

abstract

A subclass may call an overridden superclass method by ________.

prefixing its name with the super key word and a dot (.)

The ________ key word is used to call a superclass constructor explicitly.

super

In a class hierarchy ________.

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

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

final

A protected member of a class may be directly accessed by ________.

methods of a subclass, methods in the same package, methods of the same class

When declaring class data members it is best to declare them as ________.

private members

Given the following code: Line 1 public class ClassA Line 2 { Line 3 public ClassA() {} Line 4 public void method1(int a){} Line 5 } Line 6 public class ClassB extends ClassA Line 7 { Line 8 public ClassB(){} Line 9 public void method1(){} Line 10 } Line 11 public class ClassC extends ClassB Line 12 { Line 13 public ClassC(){} Line 14 public void method1(){} Line 15 }

This is an error and will cause the program to crash.

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

abstract

When an "is a" relationship exists between objects, the specialized object has ________.

all of the public and protected variables and methods of the general object plus additional characteristics

When a subclass overloads a superclass method ________.

both methods may be called with a subclass object

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

class hierarchy

If two methods have the same name but different signatures they are ________.

overloaded

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

instanceOf

In an inheritance relationship ________.

the superclass constructor always executes before the subclass constructor

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

overrides


Ensembles d'études connexes

Science words #2a part of an organism that is typically self-contained and has a specific vital function,

View Set

Safety and Infection Control - ML6

View Set

EVERYTHING YOU SHOULD KNOW FOR THE FINAL EXAM FOR INTRO TO CORRECTIONS LEJ 104 in Revel Pearson

View Set

12 - Intermediate Acctg 9th Ed McGraw Hill Ch-12 Investments - Learning Objectives

View Set

Chapter 14: Escrow and Title Insurance

View Set

Eating Disorders (Anorexia, Bulimia, Obesity)

View Set

Cherry & Jacob Ch 20. Effective Delegation & Supervision

View Set

NETAUTH MOD 9,10,11,12 questions

View Set

Read and DO LS Chapter 3: The Income Statement

View Set