Java II Chapter 11: Advanced Inheritance Concepts

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following is NOT true regarding abstract methods? a. Abstract methods must be implemented in child classes. b. Abstract methods have no body. c. Abstract methods use the abstract keyword in declarations. d. Abstract methods are inherited by their children. REFERENCES: 538-539

d. Abstract methods are inherited by their children.

If you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____________ when defining the method. REFERENCES: 539

Abstract

If Java did not allow you to ____ classes, you would need to create every part of a program from scratch. a. extend b. override c. abstract d. import REFERENCES: 564

a. extend

A class that will be placed in a nondefault package for others to use must be private. a. True b. False REFERENCES: 575

b. False

Classes from which objects can be instantiated are called constant classes. a. True b. False REFERENCES: 538

b. False

When you create a superclass and one or more subclasses, each object of each subclass is a subclass object. a. True b. False REFERENCES: 547

b. False

Java's Object class contains a public method named ____ that returns an integer representing the hash code. a. length() b. hashCode() c. hcode() d. toString() REFERENCES: 559

b. hashCode()

A(n) ____ class is a class that you create only to extend from. a. abstract b. inheritance c. parent d. final REFERENCES: 538

a. abstract

When you create a class and use the implements clause to implement an interface but fail to code one of the interface's methods, the compiler error generated indicates that you must declare your class to be ____. a. abstract b. static c. public d. related REFERENCES: 570

a. abstract

In the Java programming language, a package or class library is often delivered to users as a(n) _________________ file. REFERENCES: 575

JAR

Classes, such as the String class, have their own equals()methods that overload the ____ class method. a. Object b. Public c. Abstract d. Child REFERENCES: 559

a. Object

When you define a class, if you do not explicitly extend another class, your class is an extension of the ____ class. a. Object b. super c. public d. abstract REFERENCES: 564

a. Object

Abstract classes and interfaces are similar in that you cannot instantiate concrete objects from either one. a. True b. False REFERENCES: 569

a. True

If you create an empty method within an abstract class, the method is abstract even if you do not explicitly use the keyword abstract. a. True b. False REFERENCES: 539

a. True

It is common to create an interface when you want a class to implement behavior from more than one parent. a. True b. False REFERENCES: 570

a. True

The capability to inherit from more than one class is called ____. a. multiple inheritance b. collision c. polyinheritance d. dynamic method binding REFERENCES: 565

a. multiple inheritance

When you create a number of classes that inherit from each other, as well as multiple interfaces that you want to implement with these classes, you often will find it convenient to place these related classes in a(n) _____________. REFERENCES: 574

package

In other programming languages, such as C++, abstract classes are known as ___________ classes. REFERENCES: 538

Virtual

If you attempt to instantiate an object from an abstract class, you receive an error message from the compiler that you have committed a(n) ____. a. LogicError b. InstantiationError c. SyntaxError d. ObjectError REFERENCES: 538

b. InstantiationError

____ compress the data they store, which reduces the size of archived class files. a. Dynamic method bindings b. JAR files c. Type-import-on-demand declarations d. Interfaces REFERENCES: 575

b. JAR files

An application's ability to select the correct subclass method is known as ____. a. implementing methods b. dynamic method binding c. implicit casting d. method fixing REFERENCES: 549

b. dynamic method binding

A(n) ____ is not an object, but it points to a memory address. a. abstract class b. reference c. extend d. interface REFERENCES: 547

b. reference

The ____ method is useful in debugging a program because it can be used to display and examine values. a. finalize() b. toString() c. notify() d. equals() REFERENCES: 557

b. toString()

Which of the following statements creates an array of three Animal references? a. Animal[] ref = new Animal(3); b. Animal[] new = ref Animal[3]; c. Animal[] animalRef = new Animal[3]; d. Animal[] ref = extend Animal[3]; REFERENCES: 552

c. Animal[] animalRef = new Animal[3];

If you do not specify a package for a class, it is placed in an unnamed ____ package. a. system b. language c. default d. general REFERENCES: 575

c. default

You sometimes create an abstract class only so you can ____ it to another class. a. link b. copy c. extend d. abstract REFERENCES: 540

c. extend

When a class both extends and implements, by convention the ____ clause follows the extends clause in the class header. a. extends b. new c. implements d. if REFERENCES: 567

c. implements

When you show abstract classes and methods in class diagrams, their names appear in ____. a. bold b. all caps c. italics d. blue REFERENCES: 538

c. italics

The Objectclass ____ method converts an Object into a String that contains information about the Object. a. equals() b. setType() c. toString() d. speak() REFERENCES: 556

c. toString()

While a class can inherit from multiple abstract superclasses, it implement only one interface. a. True b. False REFERENCES: 569

b. False

Java does not allow a class to inherit directly from two or more parents. a. True b. False REFERENCES: 566

a. True

The java.lang package contains fundamental classes and is imported automatically each time a program is written. a. True b. False REFERENCES: 574

a. True

When you create a new subclass in Java, neither the superclass source code nor the superclass ____ is changed. a. bytecode b. object c. argument d. possession REFERENCES: 565

a. bytecode

When you assign a variable or constant of one type to a variable of another type, the behavior is called ____. a. implicit conversion b. referencing c. dynamic method binding d. containing REFERENCES: 548

a. implicit conversion

Instead of using the automatic toString()method with your classes, it is usually more useful to write your own ____ version of the toString()method that displays some or all of the data field values for the object with which you use it. a. overloaded b. protected c. static d. condensed REFERENCES: 557

a. overloaded

____ is a calculated number that is used to uniquely identify an object. a. Method binding b. A hash code c. Implicit conversion d. Ad-hoc polymorphism REFERENCES: 557

b. A hash code

When you create a class that uses an interface, you include the keyword extends. a. True b. False REFERENCES: 566

b. False

21. The Object class equals()method returns a(n) ____ value indicating whether the objects are equal. a. int b. equals c. null d. boolean REFERENCES: 559

d. boolean

A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract. a. hash code b. package c. collision d. interface REFERENCES: 566

d. interface

The Object class equals()method returns a boolean value indicating whether the objects are equal. This equals()method considers two objects to be equal only if they have the same ___________. REFERENCES: 559

hash code


Conjuntos de estudio relacionados

Personal Financial Statements Vocabulary

View Set

Leadership - Ch 8 - MGMT-5370-W01 - SEMINAR

View Set