Interfaces and Abstract Classes

Java interfaces and abstract classes: naming a capability, sharing state, default methods, and choosing between the two.

  • 8 cards
  • 5 questions
  • About 8 min
  • Intermediate to Advanced
Share

Interfaces, which name what a class can do without saying how, and abstract classes, which are partly written classes that subclasses complete. The choice between them is made by reflex more often than almost anything else in Java, and one question decides it: is there state every implementation keeps in the same way? It covers interfaces, an example with Comparable, abstract classes, the deciding question, default methods, why a class has one parent and many interfaces, and what an interface may hold. It leaves sealed types and records to their own topics.

Contents

8 cardsnot started