抽象数据类型和接口 [英] Abstract Data Type and Interface

查看:117
本文介绍了抽象数据类型和接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java新手。抽象数据类型和接口之间有什么区别。

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

例如我们有一个ListADT

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);
}

我们将ADT定义为接口。 NoW ADT和Interface有什么区别或者ADT是一个接口

Where we are defining the ADT as an interface. NoW What is the difference between ADT and Interface Or ADT is an Interface

推荐答案

What is the difference between Abstract data type and Interface.




  1. Java接口中声明的变量默认为final。
    抽象类可能包含非最终变量。

  2. 默认情况下,Java接口的成员是公共的。 Java抽象
    类可以拥有通常的类成员,如private,
    protected等。
    检查这个信息链接

  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

这篇关于抽象数据类型和接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆