DATA TYPES IN JAVA 

Data Type: 
  • It is the process of allocating a block of memory to store the data by specifying the size and the type of the data.
  • There are two types of data type we have

    • Non Primitive data type:-
      • Non Primitive data type is the data type which does not have fix size.
        • ex. String, etc.

    • Primitive data type:-
      • The data type which have fix size.
      • There are 8 different types of primitive data types we have.

 

Data Type

Size

 

Integer

byte

1 byte

short

2 byte

int

4 byte

long

8 byte

 

 

 

Character

char

2 byte

 

 

 

Floating Number

float

4 byte

double

8 byte

 

 

 

Boolean

boolean

1 bit