Data Size Description e.g.
type
byte 1 byte=8 Byte length integer
bits
short 2 bytes Short integer (small range short x;
=16 bits of integers) x=45;
int 4 bytes=32 Integer can store a number int a;
bits without decimals a=4589;
long 8 bytes=64 Long can store a large long n;
bits range of integer without n=89887654;
decimals
Fractional numeric types:
Fractional numeric types can store fractional numbers i.e. numbers having
decimal points. These are also called floating point data types.
Floating point data types are:
Data Size Description e.g Remarks
type
float 4 Single float p; Precision upto 6 digits
bytes=32 precision p=78.54f; e.g:percentage,length
bits floating point currency,temperature,
Stores small
range of
decimal value
double 8 Double double Precision upto 15
bytes= precision d; digits. E.g: large nos
64 bits floating d=9.089 or high precision such
point 9; as for astronomy or
Stores subatomic physics
large
range of
decimal
value
Size Description eg Remarks
Data
type
2 Single char a; Unicode characters
char bytes character a=’C’; (whereas other
=16 a=’@’ languages use 1 byte
bits ; ASCII text characters)
a=’*’; e.g: alphabets and
numerals
Data Size Description Range Remarks
type
boolean Java Logical or True or Useful in
reserves 8 Boolean false. logic test
bits but values These with if
only uses values are
1 bit reserved
words
Data type and their byte size
byte 1 byte - 8 bits
boolean 1 byte - 8 bits
char 2 bytes - 16 bits
short 2 bytes - 16 bits
int 4 bytes - 32 bits
float 4 bytes - 32 bits
long 8 bytes - 64 bits
double 8 bytes - 64 bits