You are on page 1of 12

ABSTRACT DATA TYPE

DATA TYPE
A data type is characterized by:

a set of values a data representation, which is common to all these values and a set of operations, which can be applied uniformly to all these values.

Primitive Data Types


1. Integer- stores whole numbers and signed numbers - the number system that we are accustomed using to represents such values in a decimal or base ten number system w/c are 0-9. 2. Floating-point (Real Data) stores real numbers(fractional values) 3. Character stores a character. Ideal for storing names of things. - based on the assignment of a numeric code to each of the characters in the character set(ASCII & EBCDIC).

4. Boolean stores a true or false value.

TYPE NAME
Byte Short Int Long Float Double Char Boolean

KIND OF VALUE MEMORY USED Integer Integer Integer integer floating point number floating point number single character true or false 1 byte 2 bytes 4 bytes 8 bytes 4 bytes 8 bytes 2 bytes 1 bit

SIZE RANGE

-128 to 127 -32768 to 32767 -2147483648 to 2147483647 -9223372036854775808 to 9223372036854775807 3.40282347x1038 to 1.40239846x1045 1.76769313486231570 to 4.94065645841246544x10324 all Unicode character Not applicable

Integers
- An integer that is stored w/ a sign is called signed numbers; an integer that isnt stored w/ a sign is called unsigned numbers. An unsigned integer is a value that is implied to be positive. The positive sign is not stored in memory. All integers in Java are represented w/ a sign. Zero is stored as a positive number.

Floating Point
- used to store real numbers in memory. A real number contains a decimal value. - Refers to the way decimals are referenced in memory.

2 Kinds of Floating Point : float- is a single precision number double- is a double precision number Precision of a number is the number of places after the decimal point that contains an accurate value. 2 Parts of a Floating-Point number: a. the real number-w/c is stored as a whole number b. the position of the decimal point within the whole number

Characters
- is represented as an integer value that corresponds to a character set - A character set assigns an integer value to each character, punctuation, and symbol used in language. - Choose a char whenever you need to store a single character in memory. - It reserves 16 bits of main memory.

Boolean
- reserves memory to store a boolean value, w/c is a true or false represented as a 0 or 1. - Choose a boolean whenever you need to store one of two possibilities in memory. - It reserves 1 bit of main memory.

Abstract Data Type (ADT)


"A set of data values and associated operations that are precisely specified independent of any particular implementation. a specification of a set of data and the set of operations that can be performed on the data.

Classes in Java
A class defines a data type The possible values of a class are called objects The operations on the objects are called methods The data representation is all the fields that are contained within the object If there is no external access to the data representation, you have an abstract data type Suns Java classes are (almost all) abstract data types

ADTs
List Queues Stacks Trees String Map Set

You might also like