“抽象数据类型”和“引用数据类型”的概念是否指同一事物,因此与“原始数据类型”对立使用?
谢谢!
最佳答案
传统上,“Abstract Data Type ”(另请参见 this definition )用于指定“类”的抽象概念。维基百科说:
Abstract data types are purely theoretical entities, used (among other things) to simplify the description of abstract algorithms, to classify and evaluate data structures, and to formally describe the type systems of programming languages. However, an ADT may be implemented by specific data types or data structures, in many ways and in many programming languages; or described in a formal specification language. ADTs are often implemented as modules: the module's interface declares procedures that correspond to the ADT operations, sometimes with comments that describe the constraints. This information hiding strategy allows the implementation of the module to be changed without disturbing the client programs.
特别是,数字数据类型,无论是原始类型还是引用类型,都是“抽象数据类型”的实例。
Java Language Specification使用第 4.1 章中的“原始数据类型/值”和“引用数据类型/值”一词:
4.1 The Kinds of Types and Values
There are two kinds of types in the Java programming language: primitive types (§4.2) and reference types (§4.3). There are, correspondingly, two kinds of data values that can be stored in variables, passed as arguments, returned by methods, and operated on: primitive values (§4.2) and reference values (§4.3).
但是,“抽象数据类型”一词从未被使用过,这是有充分理由的。
关于java - 理论-Java-抽象数据类型和引用数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24782590/