/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Free solutions & answers for Java How to Program Chapter 10 - (Page 1) [step by step] | 91影视

91影视

Problem 1

Fill in the blanks in each of the following statements: a) Polymorphism helps eliminate _______ logic. b) If a class contains at least one abstract method, it is a(n) ___________ class. c) Classes from which objects can be instantiated are called __________ classes. d) ___________ involves using a superclass variable to invoke methods on superclass and subclass objects, enabling you to 鈥減rogram in the general.鈥 e) Methods that are not interface methods and that do not provide implementations must be declared using keyword ___________. f) Casting a reference stored in a superclass variable to a subclass type is called __________.

Problem 2

State whether each of the statements that follows is true or false. If false, explain why. a) It is possible to treat superclass objects and subclass objects similarly. b) All methods in an abstract class must be declared as abstract methods. c) It is dangerous to try to invoke a subclass-only method through a subclass variable. d) If a superclass declares an abstract method, a subclass must implement that method. e) An object of a class that implements an interface may be thought of as an object of that interface type.

Problem 3

How does polymorphism enable you to program 鈥渋n the general鈥 rather than 鈥渋n the specific鈥? Discuss the key advantages of programming 鈥渋n the general.鈥

Problem 4

A subclass can inherit 鈥渋nterface鈥 or 鈥渋mplementation鈥 from a superclass. How do inheritance hierarchies designed for inheriting interface differ from those designed for inheriting implementation?

Problem 5

What are abstract methods? Describe the circumstances in which an abstract method would be appropriate.

Problem 6

How does polymorphism promote extensibility?

Problem 7

Discuss four ways in which you can assign superclass and subclass references to variables of superclass and subclass types.

Problem 8

Compare and contrast abstract classes and interfaces. Why would you use an abstract class? Why would you use an interface?

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks