O'Reilly logo

Just Java™ 2 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 11. Interfaces

  • What Problem Does an Interface Solve?

  • Interface java.lang.Comparable

  • Interfaces Versus Abstract Classes

  • Granting Permission Through an Interface—Cloneable

  • What Protected Really Means

  • Using Interface Callbacks for GUI Event Handlers

  • The Class Double

  • Exercises

  • Some Light Relief—The Java-Powered Toaster

Interfaces are an important concept in Java. In this chapter, we'll explain what interfaces do, and how you use them. Here's a summary of what interfaces do, so you can see where we're headed.

In a few words, an interface is similar to a class that only abstract methods. You can't instantiate an abstract class; its purpose is to force any subclasses to implement its methods. That allows other classes to rely ...

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