previous | start | next

Syntax 9.2: Implementing an Interface

  public class ClassName
    implementsInterfaceName, InterfaceName, ...
{
   methods
   instance variables
}

Example:

  public class BankAccount
   implements Measurable
{
   // other BankAccount methods
   public double getMeasure()
   {
      // method implementation
   }
}

Purpose:

To define a new class that implements the methods of an interface



previous | start | next