Exam 11: Advanced Inheritance Concepts

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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.

(Multiple Choice)
5.0/5
(44)

When you create a superclass and one or more subclasses, each object of each subclass is a subclass object.

(True/False)
4.8/5
(37)

Which of the following statements creates an array of three Animal references?

(Multiple Choice)
4.8/5
(38)

The Object class ____ method converts an Object into a String that contains information about the Object .

(Multiple Choice)
4.8/5
(39)

A(n) ____ class is a class that you create only to extend from.

(Multiple Choice)
4.9/5
(40)

   The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible. The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible.

(Essay)
4.8/5
(38)

The ____ method is useful in debugging a program because it can be used to display and examine values.

(Multiple Choice)
4.9/5
(32)

Give an example of how you can create an interface to have a class implement behavior from more than one parent.

(Essay)
4.8/5
(29)

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) ____.

(Multiple Choice)
4.7/5
(38)

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) ____________________.

(Short Answer)
4.7/5
(35)

What is an abstract class? Give an example and explain how it works.

(Essay)
4.8/5
(38)

If you do not specify a package for a class, it is placed in an unnamed ____ package.

(Multiple Choice)
4.8/5
(35)

public class CarReference {     public static void main(String[] args)     {        Car carRef;        ----Code here---        carRef.color();     } } Suppose you have created a Car class and Honda and Ford subclasses. Using the above code, complete the indicated statement to create a new Honda object that is assigned to the Car reference.

(Short Answer)
4.9/5
(48)

You sometimes create an abstract class only so you can ____ it to another class.

(Multiple Choice)
4.9/5
(38)

In other programming languages, such as C++, abstract classes are known as ____________________ classes.

(Short Answer)
4.9/5
(45)

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

(Short Answer)
4.9/5
(40)

When a class both extends and implements, by convention the ____ clause follows the extends clause in the class header.

(Multiple Choice)
4.8/5
(45)

Java does not allow a class to inherit directly from two or more parents.

(True/False)
4.8/5
(29)

Abstract classes and interfaces are similar in that you cannot instantiate concrete objects from either one.

(True/False)
4.8/5
(34)

   The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important. The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important.

(Essay)
4.9/5
(39)
Showing 21 - 40 of 66
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)