Java Reference
In-Depth Information
implements the
Measurable
interface. Following is a test program that illustrates
that fact.
Interfaces can reduce the coupling between classes.
Figure 1
shows the relationships between the
Measurable
interface, the classes that
implement the interface, and the
DataSet
class that uses the interface. In the UML
notation, interfaces are tagged
with a Ȓstereotypeȓ indicator
ÆinterfaceÇ
. A
dotted arrow with a triangular
tip denotes the Ȓis-aȓ relationship between a class and
an interface. You have to look carefully at the arrow tipsȌa dotted line with an open
arrow tip
391
392
denotes the Ȓusesȓ relationship or dependency.
Figure 1
UML Diagram of the
DataSet
Class and the Classes that Implement the
Measurable
Interface
This diagram shows that the
DataSet
class depends only on the
Measurable
interface. It is decoupled from the
BankAccount
and
Coin
classes.
S
YNTAX
9.1: Defining an Interface
public interface InterfaceName
{
method signatures
}