Interfaces

The chapter continues with an introduction to Java interfaces, which are particularly useful for assigning common functionality to possibly unrelated classes. This allows objects of these classes to be processed polymorphically—objects of classes that implement the same interface can respond to all of the interface method calls. To demonstrate creating and using interfaces, we modify our payroll application to create a generalized accounts payable application that can calculate payments due for company employees and invoice amounts to be billed for purchased goods.

Get Java™ How To Program (Early Objects), Tenth 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.