In Java Programming Language totally 8 primitive datatypes are available. These primitive datatypes are predefined by the language and named by a keyword.

[su_list icon=”icon: arrow-circle-o-right”]

  • byte
  • short
  • int
  • long
  • float
  • double
  • char
  • boolean


Let us see these eight primitive data types in detail.

Byte data type is an 8-bit
Minimum range is -128 (-2^7)
Maximum range is 127 (inclusive)(2^7 -1)
Default value is 0
Example: byte age = 35

Short data type is a 16-bit
Minimum range is -32,768 (-2^15)
Maximum range is 32,767 (inclusive) (2^15 -1)
Default value is 0.
Example: short empId = 10000

int data type is a 32-bit
Minimum range is – 2,147,483,648 (-2^31)
Maximum range is 2,147,483,647(inclusive) (2^31 -1)
The default value is 0
Example: int customerId = 100000

Long data type is a 64-bit
Minimum range is -9,223,372,036,854,775,808(-2^63)
Maximum range is 9,223,372,036,854,775,807 (inclusive)(2^63 -1)
Default value is 0L
Example: long productId = 100000L

Float data type is a single-precision 32-bit
Default value is 0.0f
Example: float price = 234.5f

double data type is a double-precision 64-bit
Default value is 0.0d
Example: double currencyRate = 123.4

boolean data type represents one bit of information
boolean will hold only two possible values that are: true and false
Default value is false
Example: boolean status = true

char data type is a single 16-bit Unicode character
Minimum range is ‘\u0000’ (or 0)
Maximum range is ‘\uffff’ (or 65,535 inclusive)
Example: char letter = ‘A’


No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *