Exercises

10.3How does polymorphism enable you to program “in the general” rather than “in the specific”? Discuss the key advantages of programming “in the general.”
10.4A subclass can inherit “interface” or “implementation” from a superclass. How do inheritance hierarchies designed for inheriting interface differ from those designed for inheriting implementation?
10.5What are abstract methods? Describe the circumstances in which an abstract method would be appropriate.
10.6How does polymorphism promote extensibility?
10.7Discuss four ways in which you can assign superclass and subclass references to variables of superclass and subclass types.
10.8Compare and contrast abstract classes and interfaces. Why would you use an abstract class? Why would ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.