Primitive
In computer science, a primitive is a fundamental data type that cannot be broken down into a more simple data type. For example, an integer is a primitive data type, while an array, which can store multiple data types, is not.
Some programming languages support more data types than others and not all languages implement data types the same way. However, most high-level languages share several common primitives.
Java, for instance, has eight primitive data types:
- boolean – a single TRUE or FALSE value (typically only requires one bit)
- byte – 8-bit signed integer (-127 to 128)
- short – 16-bit signed integer (-32,768 to 32,767)
- int – 32-bit signed integer (-231 to -231 -1)
- long – 64-bit signed integer (-263 to -263 -1)
- float – 32-bit floating point number
- double – 64-bit floating point number
- char – 16-bit Unicode character
Primitives supported by each programming language are sometimes called "built-in data types" since they store values directly in memory. Non-primitive data types store references to values rather than the values themselves. Examples of non-primitive Java data types include arrays and classes.