|
|
|
|||
|
Creating InterfacesThe Java language supports interfaces that you use to define a protocol of behavior that can be implemented by any class anywhere in the class hierarchy.What Is an Interface?This section defines the term "interface," shows you an example of an interface and how to use it, and talks about why you may need interfaces in your programs. Defining an InterfaceDefining an interface is similar to creating a new class. An interface definition has two components: the interface declaration and the interface body.The interfaceDeclaration declares various attributes about the interface such as its name and whether it extends another interface. The interfaceBody contains the constant and method declarations within the interface. Implementing the
| |||
|