Interface Implementation

  • Interfaces are contracts for what a class can do, but they say nothing about the way in which the class must do it.
  • Interfaces can be implemented by any class, from any inheritance tree.
  • An interface is like a 100-percent abstract class, and is implicitly abstract whether you type the abstract modifier in the declaration or not.
  • An interface can have only abstract methods, no concrete methods allowed.
  • 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 has the following properties:
  • It provides concrete implementations for the interface's methods.
  • It must follow all legal override rules for the methods it implements.
  • It must not declare any new checked exceptions for an implementation method.