Interface : interface « Object Oriented « SCJP






Interfaces are contracts for what a class can do.

An interface is like a 100-percent abstract class.
An interface can have only abstract methods, no concrete methods allowed.

A single class can implement many interfaces.

Interfaces can be implemented by any class, from any inheritance tree.

Interface methods are by default public and abstract, explicit declaration of these modifiers is optional.

Interfaces can have constants, which are always implicitly public, static, and final.

Interface constant declarations of public, static, and final are optional in any combination.

A legal nonabstract implementing class must not declare any new checked exceptions for an implementation method.

A class implementing an interface can itself be abstract.

A class can extend only one class, but it can implement many interfaces.

Interfaces can extend one or more other interfaces.

Interfaces cannot extend a class, or implement a class or interface.

Interface methods must not be static.

Because interface methods are abstract, they cannot be marked final, strictfp, or native. 

An interface must be declared with the keyword interface.

Interface types can be used polymorphically

Typing in the abstract modifier is considered redundant for interface

Interfaces are implicitly abstract whether you type abstract or not. 

public abstract interface MyInterface{ }
public interface MyInterface { }

The public modifier is required if you want the interface to have public rather than default access.








6.12.interface
6.12.1.Interface
6.12.2.An interface variable is final and can never be given a value by the implementing class.