Data Types In Java .

In this session i have discussed the data types in Java .


A data type is used to specify the type of data that a variable can store such as integer, floating, character, double etc.


There are two data types in java as follows .

Types
Data Types
Primitive byte , short , int , float , double , char , boolean
Non Primitive Array , String , Classes (discuss later chapter)
.


Primitive Data Type

The following table display the data type , size and their description .

Data Types
Size
Description
byte 1 byte Stores whole numbers from -128 to 127
short 2 bytes Stores whole numbers from -32768 to 32767
int 4 bytes Stores whole numbers from -2,147,483,648 to 2,147,483,647
long 8 bytes Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,808
float 4 bytes Stores fractional numbers from 3.4e-038 to 3.4e+038. Sufficient for storing 6 to 7 decimal digits
double 8 bytes Stores fractional numbers from 1.7e-308 to 1.7e+038. Sufficient for storing 15 decimal digits
boolean 1 byte Stores true or false values
char 2 bytes Stores a single character/letter
.

Welcome to AndroidATPoint.

back image                     next image