6 Aug 2016

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)

DataType Default Value Size Type
byte 0 1 byte Integral Value
short 0 2 byte Integral Value
int 0 4 byte Integral Value
long 0L 8 byte Integral Value
float 0.0f 4 byte Floating Point
double 0.0d 8 byte Floating Point
char '\u0000' 2 byte Character
boolean false 1 bit Boolean

Note: \u0000 means 0 in UNICODE (Universal International Standard Character Encoding)


Post a Comment

Comment Here