aRCo
aRCo

Reputation: 1

Theory - Java - Abstract data type and reference data type

Do the concepts of "Abstract data type" and "Reference data type" refer to the same thing and, thus, used in contraposition of "Primitive data type"?

Thanks!

Upvotes: 0

Views: 719

Answers (2)

David Tonhofer
David Tonhofer

Reputation: 15338

Traditionally, the "Abstract Data Type" (see also this definition) is used to designate the abstract concept of a "class". Wikipedia says:

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.

In particular, a numeric data type, whether primitive type or reference type, are instances of "abstract data types".

The Java Language Specification uses the words "Primitive Data Type/Values" and "Reference Data Types/Values" in chapter 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).

However, the "abstract data type" wording is never used, with good reason.

Upvotes: 1

Phe0nix
Phe0nix

Reputation: 157

In java it does, in my opinion.
The simple explaination is, that you can't use any data type except for primitives or classes and classes are reference datatypes.

Upvotes: 0

Related Questions