javainterfaceterminologyabstract-data-type

Abstract Data Type and Interface


What is the difference between an abstract data type and an interface?

For Example We have a ListADT

interface MyListADT<T> {
    void add(T var);
    void add(T var,int pos);
    void display();
    T remove(int pos);
    void clear();
    boolean contains(Object o);
}

Where we are defining the ADT as an interface.


Solution

  • What is the difference between Abstract data type and Interface.
    
    1. Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
    2. Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected, etc.. check this link for info