• There are two categories of data types
  • Primitive types
  • Non primitive types
  • Java provides eight primitive types of data:
Byte Short Int Long Char Float Double Boolean
  • The primitive types are also known as simple or basic data types.
  • These can be represented in four groups:
Integer Floating-point numbers
Characters Boolean

Integer

  • Java provides four integer types: byte, short, int, long.
  • All of these are signed, positive and negative values.
Type Size/bytes Range
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 Types

  • 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.
Type Size/bytes Range
Float 32 1.4e – 045 to 3.4e + 038
Double 64 4.9e – 324 to 1.8e + 308

Character

  • It is used to store characters.
Type Size/bytes Range
Char 16 0 to 65,536

Boolean

  • It is used to store logical values either True or False.
Type Size/bytes Range
Boolean 1 True/False