CH 11: Advanced Inheritance Concepts
Java does not allow a class to inherit directly from two or more parents.
True
The java.lang package contains fundamental classes and is imported automatically each time a program is written.
True
If you do not specify a package for a class, it is placed in an unnamed ____ package.
default
If Java did not allow you to ____ classes, you would need to create every part of a program from scratch.
extend
You sometimes create an abstract class only so you can ____ it to another class.
extend
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 ____.
hash code
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) ____.
package
The Object class ____ method converts an Object into a String that contains information about the Object.
toString()
____ is a calculated number that is used to uniquely identify an object.
A hash code
Which of the following is NOT true regarding abstract methods?
Abstract methods are inherited by their children.
Which of the following statements creates an array of three Animal references?
Animal[] animalRef = new Animal[3];
A functional interface ____.
contains just one abstract method
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.
abstract
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal.
boolean
When you create a new subclass in Java, neither the superclass source code nor the superclass ____ is changed.
bytecode
A class that will be placed in a nondefault package for others to use must be private.
False
Classes from which objects can be instantiated are called constant classes.
False
When you create a class that uses an interface, you include the keyword extends.
False
While a class can inherit from multiple abstract superclasses, it can implement only one interface.
False
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) ____.
InstantiationError
In the Java programming language, a package or class library is often delivered to users as a(n) ____ file.
JAR
____ compress the data they store, which reduces the size of archived class files.
JAR files
Classes, such as the String class, have their own equals() methods that overload the ____ class method.
Object
When you define a class, if you do not explicitly extend another class, your class is an extension of the ____ class.
Object
Abstract classes and interfaces are similar in that you cannot instantiate concrete objects from either one.
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.
True
It is common to create an interface when you want a class to implement behavior from more than one parent.
True
When you create a superclass and one or more subclasses, each object of each subclass is a subclass object.
True
A(n) ____ class is a class that you create only to extend from.
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 ____.
abstract
An application's ability to select the correct subclass method is known as ____.
dynamic method binding
Java's Object class contains a public method named ____ that returns an integer representing the hash code.
hashCode()
When a class both extends and implements, by convention the ____ clause follows the keyword extends in the class header.
implements
When you assign a variable or constant of one type to a variable of another type, the behavior is called ____.
implicit conversion
A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract.
interface
When you show abstract classes and methods in class diagrams, their names appear in ____.
italics
The capability to inherit from more than one class is called ____.
multiple inheritance
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.
overloaded
A(n) ____ is not an object, but it points to a memory address.
reference
The ____ method is useful in debugging a program because it can be used to display and examine values.
toString()
In other programming languages, such as C++, abstract classes are known as ____ classes.
virtual