Professional Documents
Culture Documents
Types Java
Types Java
1. Integer
Integer types can hold whole numbers such as 123 and 96. The size of the values t
hat can be stored depends on the integer type that we choose.
Type
byte
short
int
long
Size
1 byte
2 bytes
2. Floating Point
Type
float
double
Size
4 bytes
8 bytes
3. Character
It stores character constants in the memory. It assumes a size of 2 bytes, but b
asically it can hold only a single character because char stores unicode charact
er sets. It has a minimum value of u0000 (or 0) and a maximum value of uffff (or 65,
535, inclusive).
The Eight Data Types of Java
Type
byte
float
double
char
Explanation
An 8 bit (1 byte) integer value
A 32 bit (4 byte) floating point value
A 64 bit (8 byte) floating point value
A 16 bit character using the Unicode encoding scheme