• Home
  • Textbooks
  • Introduction to Programming with Java: A Problem Solving Approach
  • Type Details and Alternative Coding Mechanisms

Introduction to Programming with Java: A Problem Solving Approach

John Dean, Ray Dean

Chapter 14

Type Details and Alternative Coding Mechanisms - all with Video Answers

Educators


Section 1

Review Questions

Problem 1

If you want a class you define to inherit methods from the Object class, you
must append the suffix extends Object to your class’s heading. (T / F)

Check back soon!

Problem 2

When used to compare reference variables, the == operator works the same
as the Object class’s equals method. (T / F)

Check back soon!

Problem 3

What does the equals method defined in the String class compare?

Check back soon!

Problem 4

What is returned by the Object class’s toString method?

Check back soon!

Problem 5

What’s wrong with replacing the println statement in Figure 14.2’s main
method with these two statements?
String description = car.toString();
System.out.println(description);

Check back soon!

Problem 6

The return type of an overriding method must be the same as the return type
of the overridden method. (T / F)

Check back soon!

Problem 7

In Java, polymorphic method calls are bound to method definitions at
compile time (not runtime). (T / F)

Check back soon!

Problem 8

Assume one reference variable’s class is descended from another reference
variable’s class. To be able to assign one reference variable to the other one
(without using a cast operator), the left-side variable’s class must be a(n)
______________ of the right-side reference variable’s class.

Check back soon!

Problem 9

A given array may contain different types of elements. (T / F)

Check back soon!

Problem 10

What are the syntax features of an abstract method?

Check back soon!

Problem 11

Any class that contains an abstract method must be declared to be an
abstract class. (T / F)

Check back soon!

Problem 12

You cannot instantiate an abstract class. (T / F)

Check back soon!

Problem 13

You can use an interface to provide direct access to a common set of
constants from many different classes. (T / F)

Check back soon!

Problem 14

You can declare reference variables to have an interface type and use them
just as you would use reference variables declared to be the type of a class
in an inheritance hierarchy. (T / F)

Check back soon!

Problem 15

Describe the access provided by the protected modifier.

Check back soon!

Problem 16

It’s illegal to use private for any method that overrides an abstract method.
(T / F)

Check back soon!