Primitive Types in Java

This is the reference section for the primitive data types that are used in the Java programming language. Primitive data types are like the atoms of the data types. They are the smallest units in the language and they can be assembled into larger data types, like molecules.

There are four essential types of primitives: integers, floating-point numbers, characters, and booleans. Of the integers, there are four variants of differing sizes: byte, short, int, and long. For floating-point types, there are to types: float and double. Finally, there is one type each for characters and booleans: char and boolean, respectively. The characteristics of each of these types is summarized in the table below.

 

These are the primitive data types that are used in the Java programming language.

NameDataRangeDefault ValueSize
bytesigned integer[-128, 127]08 bits
shortsigned integer[-32768, 32767]016 bits
intsigned integer[-2147483648, 2147483647]032 bits
longsigned integer[-9223372036854775808, 9223372036854775807]064 bits
floatfloating-pointMIN: ±1.4E-45 MAX: ±3.4028235E+380.032 bits
doublefloating-pointMIN: ±4.9E-324 MAX: ±1.7976931348623157E+3080.064 bits
charUnicode['\u0000', '\uFFFF']'\u0000'16 bits
booleanlogical value{false, true}false≥ 1 bit

In addition to these primitive types, Java contains the built-in aggregate types for strings and arrays.