Definition data type

In programming, a data type is a classification that specifies what kind of value a variable has and what kind of mathematical, relational, or logical operations can be applied to it.

For example, an integer is a data type used to classify integers, and a char is a data type used to classify a letter.

Primitive vs. non-primitive data types

Depending on the programming language, there are different types of data types. There is also a distinction between primitive and non-primitive data types. Primitive data types use a small memory area to represent a single data element, using bit patterns. Non-primitive data types are objects. An object is a block of memory that contains a large amount of data and methods. These methods can be used to manipulate the data.

Integer

This is a numeric data type used to store numbers without decimal places.

Float and Double

This is also a numeric data type used to store numbers with decimal places.

Character

A character data type is used to store a single character. This can be a letter, number, punctuation mark or symbol.

String

The String datatype is a sequence of characters and is the most commonly used datatype for storing text. In addition, a string can also contain digits and symbols, but is always treated as text.

Boolean

Boolean data types can only have the value 0 (false) or 1 (true).

Array

An array, also known as a list, is a data type that stores a number of elements, usually all of the same type.
Each element of an array can be retrieved using an integer index, and the total number of elements in an array represents the length of the array.