What Is an Interface?
In English, an interface is a device or system that unrelated entities use to interact. According to this definition, a remote control is an interface between you and a television set, the English language is an interface between two people, and the protocol of behavior enforced in the military is the interface between people of different ranks. Similarly, a Java interface is a device that unrelated objects use to interact with one another. Java interfaces are probably most analogous to protocols (an agreed-upon behavior). In fact, other object-oriented languages have the functionality of Java's interfaces, but they call their interfaces protocols.
A Java interface defines a set of methods but does not implement them. A class that implements the interface agrees to implement all of the methods defined in the interface, thereby agreeing to certain behavior.
Definition: An interface is a named collection of method definitions (without implementations). An interface can also include constant declarations
No comments:
Post a Comment
Please Provide your feedback here