Syntax
'-------,-------' v | |-implements-+-InterfaceType-+-|
Description
The optional implements clause in a class declaration lists the names of
interfaces that are direct superinterfaces of the class being declared.
An implements clause consists of the keyword implements and at least one InterfaceType. Each InterfaceType must name an accessible interface type, or a compilation error occurs. The InterfaceType is a package name followed by an identifier. All interfaces in the current package are accessible. Interfaces in other packages are accessible if the host system permits access to the package and the interface is declared public.
A compilation error occurs if the same interface is mentioned two or more times in a single implements clause, even if the interface is named in different ways.
Example
The following is an example of an implements clause:
public class MyVector implements java.util.Vector {
...
}
The following code results in a compilation error because the names java.lang.Cloneable
and Cloneable refer to the same interface :
public class Redundant implements java.lang.Cloneable, Cloneable {
int x;
}
Syntax diagrams
Java types
class keyword
Source: The Java Language Specification. Copyright (C) 1996 Sun Microsystems, Inc.