Primitive Data Types

Primitive types are the basic data types serve as the building blocks of data manipulation in any programming language including Java.

In a programming language, a variable has a type such as Integer, String, Decimal, … whether that programming language is a Static Typing such as C/C++ and Java or Dynamic Typing like PHP, javascript and Python.

In Java like other programming languages we have built-in primitive data types. A primitive date type is a basic data type provided by a programming language as a basic building block. 
Here is the list of primitive date types in Java:

Category Types Size (bits) Minimum Value Maximum Value Precision
Integer
byte 8 -128 127 From +127
to -128
char 16 0 216-1 All Unicode characters
short 16 -215 215-1 From +32,767
to -32,768
int 32 -231 231 From +2,147,483,647 to -2,147,483,648
Floating
Point
long 64 -263 263 From +9,223,372,036,854,775,807
to -9,223,372,036,854,775,808
float 32 -2149 (2-2-23)·2127 From 3.402,823,5 E+38 to 1.4 E-45
double 64 -21074 (2-2-52)·21023 From 1.797,693,134,862,315,7 E+308
to 4.9 E-324
Other
boolean false, true
void

I created couple of samples in 
https://github.com/myjavacoretutorial/primitive-types.git to play with each type.

Here your can find a brief description and sample for each Java primitive type:

Leave a Reply