Computer ScienceProgrammingEasy

Data Type

Also known as:typedatatypevalue type

A data type is a classification that specifies the kind of value a variable can hold, the operations that can be performed on it, and how its binary representation is stored in memory. Common primitive data types include integers, floating-point numbers, characters, and booleans, while composite types include arrays, strings, and objects. Choosing the correct data type is essential for memory efficiency, performance, and preventing logical errors in programs.

Common Primitive Data Types and Their Properties

Data TypeExample ValueMemory SizeUse Case
int (integer)42, -7, 04 bytes (32-bit)Counting, indexing
float3.14, -0.54 bytesDecimal calculations
double3.141592658 bytesHigh-precision math
char'A', 'z'1–2 bytesSingle characters
booleantrue / false1 bit (often 1 byte)Conditional logic
String"Hello World"VariableText data

Interactive Tools

Codecademy – Data Types

Open Tool

W3Schools – Java Data Types

Open Tool

Khan Academy – Data Types in JavaScript

Open Tool
Chart categorising primitive and composite data types

Wikimedia Commons, CC BY-SA

Related Terms

Combination of "data" (Latin "datum", meaning "given thing") and "type" (Greek "typos", meaning "impression" or "kind"). The concept was formalised in programming language theory during the 1960s, with ALGOL 60 being among the first languages to introduce explicit type declarations.

data-typesprimitivesmemoryprogramming-basicstype-system