Implementing Interfaces
Previous | Home | Next |
Syntax for implementing interface
... implements InterfaceName[, another interface, another, ...] ...
Classes may implement one or no of interfaces
by the following way classes can implement interfaces.
Public class Lion implements Animal
public boolean chasePrey(Prey p)
{
// programming to chase prey p (specifically for a lion)
}
public void eatPrey (Prey p)
{
// programming to eat prey p (specifically for a lion)
}
Previous | Home | Next |