Previous Next

Java Data Types

Data types are utilized in Java to categorize the different types of data that may be stored within a variable. There are two categories of datatypes in Java:

Primitive Data Types

There are 8 primitive data types are available in java.

Data Type Size Range
bool 1 bit true, false
char 2 byte 0 to 255
byte 1 byte -128 to 127
short 2 byte -32,768 to 32,767
int 4 byte -2,147,483,648 to 2,147,483,647
long 8 byte -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 4 byte upto 7 decimal digits
double 8 byte upto 16 decimal digits
Previous Next