Introducing Interfaces (Chapter 2)

SOLUTION 2.1An abstract class with no nonabstract methods is similar to an interface in terms of its utility. However, note the following.
  • A class can implement any number of interfaces but can subclass at most one abstract class.

  • An abstract class can have nonabstract methods, which are usually instances of the TEMPLATE METHOD pattern. All the methods of an interface are abstract, whether or not this declaration is explicit.

  • An abstract class can declare instance variables that its subclasses inherit. An interface cannot declare instance variables, although it can establish static final fields.

  • An abstract class can define constructors; an interface cannot.

  • An abstract class's visibility can be public, protected ...

Get Design Patterns Java™ Workbook 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.