Data types
We use different kind of data, with different properties (e.g. range of values), to achieve different tasks. For example, adding dates or numbers work differently. That's why we use data types.
Primitives
Primitive data types are the basic ones, necessary to built other complex data types. We also refer to them as built-in types, since they're built into the programming language.
- Numeric types - Integers and float
- Boolean types
- Textual types - Characters and Strings
Keep in mind that primitives are immutable: you can't change their value. When you declare a variable to a primitive and change it after, you're actually changing the address (reference), not the value itself.(See: Object copying).
Primitive values are still freed from memory, thanks to garbage collection