Skip to main content

Data Types in Java

Data Types in Java

Data types represent the different values to be stored in the variable. In java, there are two types of data types:
Ø  Primitive data types

Ø  Non-primitive data types

Add caption


Data Type
Default Value
Default size
boolean
false
1 bit
char
'\u0000'
2 byte
byte
0
1 byte
short
0
2 byte
int
0
4 byte
long
0L
8 byte
float
0.0f
4 byte
double
0.0d
8 byte





Why char uses 2 byte in java and what is \u0000 ?

It is because java uses Unicode system than ASCII code system. The \u0000 is the lowest range of Unicode system. To get detail explanation about Unicode visit next page.

Comments