interface

 

http://docs.oracle.com/javase/tutorial/java/IandI/interfaceDef.html

 

An interface declaration consists of modifiers, the keyword interface , the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example:

 

public interface GroupedInterface extends Interface1, Interface2, Interface3 {

    // constant declarations
    
    // base of natural logarithms
    double E = 2.718282;
 
    // method signatures
    void doSomething (int i, double x);
    int doSomethingElse(String s);
}

 An interface can extend other interfaces, just as a class can extend or subclass another class. However, whereas a class can extend only one other class, an interface can extend any number of interfaces . The interface declaration includes a comma-separated list of all the interfaces that it extends.

 

2.

All methods declared in an interface are implicitly public , so the public modifier can be omitted.

An interface can contain constant declarations in addition to method declarations. All constant values defined in an interface are implicitly public , static , and final . Once again, these modifiers can be omitted.

 

3. interface can not extends abstract class , because interface can not be instantiatd .

interface also can not implements interfaces , bcz interface can not have specific method body .

你可能感兴趣的:(interface)