Choosing Between an Interface and an Abstract Class
Interfaces and abstract classes provide similar functionality, so it is important to know when to select one over the other as you design a system. In general, you should choose interfaces over abstract classes. The use of an interface separates your design from any implementation details. Even if you declare a purely abstract class without any method implementations, you must inherit from it to define classes that share the behavior defined by its methods. Given that Java only supports single inheritance, this requirement is a significant one. If you define your required method signatures in an interface instead, you place no restrictions on the class hierarchy in your system.
If you have default ...
Get Special Edition Using Java 2 Standard 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.