Exercises

  1. 10.3 How does polymorphism enable you to program “in the general” rather than “in the specific”? Discuss the key advantages of programming “in the general.”

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

  3. 10.5 How does polymorphism promote extensibility?

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

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

  6. 10.8 (Payroll System Modification) Modify the payroll system of Figs. 10.410.9 to include private instance variable birthDate in class Employee ...

Get Java How to Program (early objects), 9/e 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.