up previous next contents
Next: Single inheritance versus multiple Up: Interfaces Previous: Objectives   Contents

Subsections

An example interface

  • Java has single inheritance of implementation - you can extend only one class.
  • Java has multiple interface inheritance.
  • All methods in an interface are implicitly abstract.
  • Each class that implements the interface must implement all its methods.
  • Methods in an interface are always public.
  • Fields in an interface are always static and final.

Nested classes and interfaces

  • Nested classes and interfaces let you associate types that are strongly related to an interface inside that interface.
  • Any class or interface inside an interface is public.
  • Any classes nested inside an interface are also static.
  • Any interface nested inside a class can be public, protected, package-accessible, or private.


up previous next contents
Next: Single inheritance versus multiple Up: Interfaces Previous: Objectives   Contents