O'Reilly logo

Just Java™ 2, Fifth Edition by Peter van der Linden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Interfaces

Interfaces

Interfaces are an important concept in Java. In this chapter we’ll explain how you use interfaces and how they work. We’ll start by describing the problem that they solve.

What Problem Does an Interface Solve?

We’ve seen in previous chapters how classes can be related in a hierarchy, with the common behavior higher up the tree. An example is given in Figure 8-1.

Where should the refuel() method go?

Figure 8-1. Where should the refuel() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required