Monday, June 18, 2012

interfaces


Interfaces

Interfaces
Need for Interfaces :
The benefits of using interfaces are much the same as the benefits of using abstract classes.Interfaces provide a means to define the protocols for a class without bothering about the implementation details.This seemingly simple benefit can make large projects much easier to manage.once interfaces have been designed, the class development can take place without bothering about communication among classes.
Another important use of interfaces is the capacity for a class to implement multiple interfaces.The major difference between inheriting multipleinterfaces and true multiple inheritance is that the interface approach enables you to inherit only method descriptions, implementations. If a classimplements multiple interfaces, that class must provide all the functionality for the methods defined in the interfaces.

» Interface is a fully abstracted class.
» Interface can have only final static variables and public abstract methods.
Syntax :
interface interface-name
{
datatype variable1, variable2?
-------------------------------
-------------------------------
return type method name (argument1,argument2,..);
----------------------------------
}

No comments:

Post a Comment