Chapter 10. Interfaces

An interface is another general programming construct provided by the Java language. An interface, in essence, is a named block of code that contains method definitions and constant variable declarations. An interface declares abstract methods that must be implemented by any class that implements the interface. The interface does not implement the methods, it defines the method name, return type, and input parameter list. An interface can also define constants that can be accessed by classes that implement the interface.

In some ways the function of an interface is similar to that of an abstract class. An interface specifies the methods a class must implement, but not how to implement them. A class that implements an interface ...

Get Technical Java™: Developing Scientific and Engineering Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.