Abstract Data Type and Interface

前端 未结 8 1377
小鲜肉
小鲜肉 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:10

    The combination of data together with its methods is called an Abstract Data Type(ADT).

    A Java Interface is a way to specify ( but not implement) an ADT.

    It specifies the names, parameters, and return types(ie, header) of the ADT methods.

    The interface does not specify the data fields (except public constants), as that is an implementation detail.

    A Java Interface specifies the requirements of an ADT as a contract between the service provider ( class that implements the ADT) and the client (the user of the class).

提交回复
热议问题