Java Program to display the minimum and maximum value of primitive data types

Java Datatype has a range, i.e. represented by a minimum and maximum. Primitive Data Types include the byte, short, boolean, int, long, float, double and char type.

Following are the minimum and maximum value of primitive data types in Java:

  • byte: An 8-bit signed two’s complement integer
    Minimum Value: -128
    Maximum Value: 127
  • short: A 16-bit signed two’s complement integer
    Minimum Value: -32768
    Maximum Value: 32767
  • int: A 32-bit signed two’s complement integer
    Minimum Value: -2,147,483,648
    Maximum Value: 2,147,483,647
  • long: A 64-bit two’s complement integer
    Minimum Value: -9,223,372,036,854,775,808
    Maximum Value: 9,223,372,036,854,775,807
  • char: A single 16-bit Unicode character.
    Minimum Value: ‘\u0000’ (or 0)
    Maximum value: ‘\uffff’
  • float: A single-precision 32-bit IEEE 754 floating point
    Minimum Value: 1.4E-45
    Maximum Value: 3.4028235E38
  • double: A double-precision 64-bit IEEE 754 floating point
    Minimum Value: 4.9E-324
    Maximum Value: 1.7976931348623157E308
  • boolean: Possible values, TRUE and FALSE.

Let’s now see some examples to display the minimum and maximum value of primitive data types:

Example 1

Output

Example 2

Output

Java Program to get the default value of primitive data types
Java Programming Examples
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading