Card 08/ 08
All 8 cards
RecapDifficulty: Advanced1 min
What Each of the Two Is For
Five things this topic established, and where each one was.
| The thing | Where |
|---|---|
| An interface names a capability and holds no per-object state | Naming What a Thing Can Do |
| An abstract class is a partly-built class, with fields and a constructor | What an Abstract Class Adds |
| The deciding question is whether there is shared state | Interface or Abstract Class |
A default method lets an interface grow without breaking implementations | default Methods |
One extends, any number of implements, because interfaces add no fields | Why You Can Implement Ten Interfaces |
State is the whole distinction. Everything else — how many you may have, what a default method may touch, why constants in an interface are shared — follows from an interface having none.