Abstract Data Types

Discussion in 'Mac Programming' started by Dr. No, Dec 11, 2005.

  1. macrumors regular

    Sep 13, 2003
    Can someone explain what an Abstract Data Type is in Java? Plus, what does it look like, and what does it do?
  2. macrumors member

    Jul 8, 2002
    An Abstract Data Type (ADT) in any programming language is an entity that is only defined by the type of data stored and the operations that may be performed on that data. That is, the operations of an ADT are defined in a public interface, but the specific way in which the operations are implemented is hidden within the ADT. The person using the ADT doesn't need to know anything about the implementation details.

    A common example of an ADT is a list. A list may have a set of public methods to insert or remove objects, but the implementation details are hidden inside the ADT. The list might be implemented using an array or a linked-list, but the person using the class doesn't need to know or care about these details.

    In Java, ADTs are frequently created by defining in interface, and then concrete classes "implement" the interface. http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
    There are also Abstract classes and abstract methods in Java, but it sounds like you're asking more about the general ADT concept.


Share This Page