Abstract Data Type and Interface

前端 未结 8 1358
小鲜肉
小鲜肉 2021-02-04 18:26

I am new to Java. What is the difference between Abstract data type and Interface.

For Example We have a ListADT

interface MyListADT {
    void          


        
8条回答
  •  抹茶落季
    2021-02-04 19:22

    As per [wiki] http://en.wikipedia.org/wiki/Abstract_data_type

    In computer science, an abstract data type (ADT) is a mathematical model for a certain class of data structures that have similar behavior; or for certain data types of one or more programming languages that have similar semantics. An abstract data type is defined indirectly, only by the operations that may be performed on it and by mathematical constraints on the effects (and possibly cost) of those operations.

    For Java programming language

    you can take Java's List interface as an example. The interface doesn't explicitly define any behavior at all because there is no concrete List class. The interface only defines a set of methods that other classes (e.g. ArrayList and LinkedList) must implement in order to be considered a List.

    but the bottom line is that it is a concept

提交回复
热议问题