Online Software Educational Training - IT Tutorials - Online Education Training for Computer Software


Home

JAVA PROGRAMMING

Understanding Interfaces

 What Is an Interface? 

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.   An interface is a named collection of method definitions (without implementations). An interface can also include constant declarations. 

Interfaces are best understood through examples, so let's look at a concrete example of an interface and two classes that use it to interact. Then we'll talk more about interfaces in the abstract and clear up some common confusion.

 


Previous

Next