Primitive Data Types in Java

Primitive Data Types in Java

Primitive Data Types are predefined by the java language and named by a keyword. There are totally eight Primitive Data Types in Java. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.
Therefore, by assigning different data types to variables, we can store various data types in these variables.
The following table gives the detail information about Primitive Data Types:

Primitive Data Types (Table)

DataTypeDefault ValueSizeType
byte01 byteIntegral Value
short02 byteIntegral Value
int04 byteIntegral Value
long0L8 byteIntegral Value
float0.0f4 byteFloating Point
double0.0d8 byteFloating Point
char‘u0000’2 byteCharacter
booleanfalse1 bitBoolean
Note: u0000 means 0 in UNICODE (Universal International Standard Character Encoding)

Leave a Reply

Your email address will not be published. Required fields are marked *