Java Chapter 10

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

The class used as a basis for inheritance is the ____ class.

Base

If a ____ method has the same name as a parent class method and you use the name with a child class object, the child method hides the original.

Static

Which of the following statements will create a class named Red that is based on the class Color?

public class Red extends Color

Which of the following statements is true?

A child class inherits from a parent class.

The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members of the parent class are not accessible within a child class's methods.

Private

When you create parent and child classes of your own, the child classes use ____ constructors.

Three

A way to discover which of two classes is the base class and which is the subclass is to _____.

try saying the two class names together in a sentence with the phrase "is a(n)

Which statement correctly declares a sedan object of the Car class?

Car sedan = new Car();

When you create a class and do not provide a(n) ____, Java automatically supplies you with a default one.

Constructor

Usually, the subclass constructor only needs to initialize the ____ that are specific to the subclass.

Data Fields

By convention, a class diagram contains the ____ following each attribute or method.

Data type

Which of the following choices is the best example of a parent class/child class relationship?

Dog/Poodle

The Java keyword that creates inheritance is _____.

Extends

You use the keyword ____ to achieve inheritance in Java.

Extends

When you want every child class to use the original parent class version of a method, use the _____ with the method.

Final

You use a _____ method access specifier when you create methods for which you want to prevent overriding in extended classes.

Final

When you employ ____, your data can be altered only by the methods you choose and only in ways that you can control.

Information hiding

____ is a mechanism that enables one class to acquire all the behaviors and attributes of another class.

Inheritance

A compiler can decide to _____ a final method—that is, determine the code of the method call when the program is compiled.

Inline

You are never aware that ____ is taking place; the compiler chooses to use this procedure to save the overhead of calling a method.

Inlining

The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.

Less error prone

Sometimes the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to ____ the parent class members.

Override

When a subclass method has the same name and argument types as a superclass method, the subclass method _____ the superclass method.

Overrides

The keyword super always refers to the _____ of the class in which you use it.

Parent class

When you instantiate an object that is a member of a subclass, the _____ constructor executes first.

Parent class

In Java, _____ members are those that can be used by a class and its descendants.

Protected

Using the keyword ____ provides you with an intermediate level of security between public and private access.

Protected

Within a subclass, you cannot override _____ methods.

Static

____ polymorphism is the ability of one method to work appropriately for subclasses of the same parent class.

Subtype

If a method has been overridden but you want to use the superclass version within the subclass, you can use the keyword _____ to access the parent class method.

Super

You can use the keyword _______ within a method in a derived class to access an overridden method in a base class.

Super

A base class can also be called a _____.

Superclass

Arrows used in a ____ to show inheritance relationships extend from the descendant class and point to the original class.

UML Diagram

Programmers and analysts sometimes use a graphical language called _____ to describe classes and object-oriented processes.

Unified Modeling Language

You can use the ____ modifier with methods when you don't want the method to be overridden.

final

In Java, the concept of keeping data private is known as _____.

information hiding

If jrStudent is an object of Student, which of the following statements will result in a value of true?

jrStudent instanceof Student

Employing inheritance reduces errors because _____.

many of the methods you need have already been used and tested

When you create a class by making it inherit from another class, the new class automatically contains the data fields and _____ of the original class.

methods

A class named Building has a public, nonstatic method named getFloors(). If School is a child class of Building, and modelHigh is an object of type School, which of the following statements is valid?

modelHigh.getFloors();

If the only constructor in a superclass requires arguments, its subclass _____.

must contain a constructor

If a programming language does not support ____, the language is not considered object-oriented.

polymorphism

In Java, using the same method name to indicate different implementations is called _____.

polymorphism

You would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?

protected

Which of the following statements depicts the valid format to call a superclass constructor from a subclass constructor?

super(name, score);


Set pelajaran terkait

Word Within the Word Test 42 Answers

View Set

medsurg exam 3 melanoma evolve and ati

View Set

Propaganda: Section D - Techniques of Exploitation (2)

View Set

Unit 3: Chemical and Physical Changes

View Set

ILTS Physical Education Content Exam (144)

View Set

CHAPTER 15 DISTRIBUTION DECISIONS

View Set

chapter 9 heath insurance basics

View Set

AP Psychology Chapter 1 Thinking Critically With Psychological Science

View Set