previous | start | next

Interfaces versus Abstract Classes

Interfaces
Abstract Classes

A class is abstract if it has at least one abstract method. An method declared as abstract has no implementation. Implementation of abstract methods are the responsibility of subclasses.

Example

 public abstract class AbstractList<E>
 {
   ...
   public void add(int index, E element) { ... } // Not abstract; implemented
   ...
   public abstract E get(int index);  // Abstract; no implementation in this class
   ...
 }
   


previous | start | next