6.2. Use interfaces

[7.1] Describe inheritance and its benefits

[7.5] Use abstract classes and interfaces

We all use interfaces quite often in our lives. For example, when you refer to someone as a runner, do you care whether that person is also an orator, a parent, or an entrepreneur? You care only that the person is able to run. The term runner enables you to refer to unrelated individuals, by opening a small window to each person and accessing behavior that’s applicable to only that person’s capacity as a runner. Someone can be referred to as a runner only if that person supports characteristics relevant to running, though the specific behavior can depend on the person.

In the preceding example, you ...

Get OCA Java SE 8 Programmer I Certification Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.