java chapter 9 terms

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Inheritance

Increases the likelihood that a system will be implemented and maintained effectively.

If the subclass constructor did not invoke the superclass's constructor explicitly

the compiler would attempt to insert a call to the superclass's default or no-argument constructor.

wait

methods notify, notifyAll and three overload versions

private

Compilation errors occur when the subclass attempts to access the superclass's __________ instance variables.

False

Constructors are inherited.

@Override annotation

Indicates that a method should override a superclass method with the same signature. If it does not, a compilation error occurs.

tight coupling

Inheritance creates ______________ among the classes in a hierarchy Each subclass typically depends on its direct or indirect superclasses' implementations

protected

access is an intermediate level of access between public and private.

deep copy

an operation that not only copies one class object to another but also makes copies of any pointed-to data

True

hidden can be accessed only through the public or protected methods inherited from the superclass

String

Class Object's toString method returns a ____________ that includes the name of the object's class

A subclass

- can be a superclass of future subclasses. - can add its own fields and method - is more specific than its superclass and represents a more specialized group of objects.

superclass

. Existing class is the

private

A class's ________ members are accessible only within the class itself.

default constructor

A class's ____________ calls the superclass's default or no-argument constructor

public

A class's ____________ members are accessible wherever the program has a reference to an object of that class or one of its subclasses.

False

A class's protected members are visible to all classes in the same package as the class containing the protected members—this is always desirable.

equals method

A method of the String class that Java uses to compare strings.

Inheritance

A new class is created by acquiring an existing class's members and possibly embellishing them with new or modified capabilities.

inheritance hierarchy

A set of hierarchical relationships between classes of objects

hidden

A superclass's private members are __________ from its subclasses

indirect, hierarchy.

An _________ superclass is any class above the direct superclass in the class ______________.

Inheritance

Can save time during program development by basing new classes on existing proven and debugged high-quality software.

extends

Every class in Java directly or indirectly __________ (or "inherits from") Object

shallow

If the array stores references to objects, the objects are not copied—a _________ copy is performed.

Has-a represents composition

In a has-a relationship, an object contains as members references to other objects

Is-a represents inheritance

In an is-a relationship, an object of a subclass can also be treated as an object of its superclass

single inheritance

Java supports only ______________________________, in which each class is derived from exactly one direct superclass.

class libraries

New classes can inherit from classes in _________________.

inheritance relationship.

Not every class relationship is an

standardize reusable components

Some day, most new software likely will be constructed from _______________, just as automoniles and most computer hardware are constructed today.

With protected instance variables in the superclass, we may need to modify all the subclasses of the superclass if the superclass implementation changes.

Such a class is said to be fragile or brittle

base class, derived class

The C++ programming language refers to the superclass as the ____________ and the subclass as the ________.

Object (in package java.lang)

The Java class hierarchy begins with class ___________________________.

direct

The _________ superclass is the superclass from which the subclass explicitly inherits.

hashCode

The ____________________ method returns an integer produced by a formula that maps your object to an address in a hash table.

shallow copy

The default implementation perform a so-called ____________ ---instance-variable values in one object are copied into another object of the same type

True

The first task of a subclass constructor is to call its direct superclass's constructor explicitly or implicitly

override

The subclass can _____________ (redefine) the superclass method with an appropriate implementation.

This is why inheritance is sometimes referred to as specialization

The subclass exhibits the behaviors of its superclass and can add behaviors that are specific to the subclass.

True

The subclass object can set an inherited variable's value directly without using a set method.

get

These lines could have used appropriate __________ methods to retrieve the values of the superclass's instance variables.

finalize

This protected method is called by the garbage collector to perform termination housekeeping on object

composition-based designs

Tightly coupled designs are more difficult to modify than those in loosely coupled

True

Using protected instance variables creates several potential problems.

is-a relationship, has-a relationship

We distinguish between the __________________ and the ______________.

super

When a subclass method overrides an inherited superclass method, the superclass version of the method can be accessed from the subclass by preceding the superclass method name with keyword ______ and a dot (.) separator.

protected

With ___________ instance variables, the subclass gets access to the instance variables, but classes that are not subclasses and classes that are not in the same package cannot access these variables directly.

super()

You can explicitly use ____________ to call the superclass's no-argument or default constructor, but this is rarely done.

To override a superclass method in a subclass, the subclass method ____.

a subclass must declare a method with the same signature as the superclass method

inheritance

is done at compile time

toString, Object.

is one of the methods that every class inherits directly or indirectly from class

Superclass constructor call syntax—

keyword super, followed by a set of parentheses containing the superclass constructor arguments.

New CommissionEmployee class modified only the instance variable declarations of Fig. 9.4 as follows:

protected final String firstName; protected final String lastName; protected final String socialSecurityNumber; protected double grossSales; protected double commissionRate;

subclass

the new class is the

True

toString Called implicitly whenever an object must be converted to a String representation.

True

toString returns a String representing an object.

To enable a subclass to directly access superclass instance variables

we can declare those members as protected in the superclass.


Kaugnay na mga set ng pag-aaral

Exercise 4-12: Statement of Cash Flows Classifications

View Set

NC life and health insurance study questions

View Set

state laws, rules, and regulations

View Set

AP Stats - Chapter 7 - Sampling Distributions

View Set

Critical Care Acute Respiratory Failure

View Set