- There are two categories of data types
- Primitive types
- Non primitive types
- Java provides eight primitive types of data:
- The primitive types are also known as simple or basic data types.
- These can be represented in four groups:
- Java provides four integer types: byte, short, int, long.
- All of these are signed, positive and negative values.
|Byte||8||-128 to 127|
|Short||16||-32,768 to 32,767|
|Int||32||-2,147,483,648 to 2,147,483,647|
|Long||64||-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807|
- Floating-Point or real numbers are used when we requires fractional precision for evaluating arithmetic calculations.
- There are two kinds of floating-point types, float and double, which represent single and double-precision numbers, respectively.
|Float||32||1.4e – 045 to 3.4e + 038|
|Double||64||4.9e – 324 to 1.8e + 308|
- It is used to store characters.
|Char||16||0 to 65,536|
- It is used to store logical values either True or False.