Monday, July 5, 2010

Implementing Interfaces

access class classname [extends superclass] [implements interface [,interface...]]
/* access is either public or not used. (default)*/

{
public return-type method-name(parameter-list) /* methods that implement an interface must be declared public.*/
{
// method body   
/*type signature of the implementing method must match exactly the type signature specified in the interface definition. */
}
}

If a class implements two interfaces that declare the same method, then the same method will be used by clients of either interface.

No comments:

Post a Comment