# Primitive Data Types

What are primitive data types in Java? **Primitive Data Types** contain actual values. A primitive data types is predefined by the Java programming language by a specific keyword for each type. There are 8 different types of primitive data in Java.

The Java programming language is designed that all variables must first be declared before they can be used. For example:

int javaCodeDepotID = 1;

The above statement is telling the program that the field named “javaCodeDepotID”, holds numerical data, and has a value of “1”. A variable’s data type defines the value it may contain as well as the operations that may be performed on the variable.

As mentioned earlier, there are eight primitive data types supported by the Java programming language. Let’s mist and discuss each data type.

**byte**– The**byte data type**is an 8 bit signed two’s complement integer. It has a minimum value of -128 (negative) and a maximum value of 127 (positive).

**short**– The**short data type**is a 16 bit signed two’s complement integer. It has a minimum value of -32,768 (negative) and a maximum value of 32,767 (positive).

**int**– The**int data type**is a 32 bit signed two’s complement integer, which has a minimum value of -2147483648 (negative) and a maximum value of 2147483647 (positive).

**long**– The**long data type**is a 64 bit two’s complement integer. The signed long has a minimum value of -9223372036854775808L (negative) and a maximum value of 9223372036854775807L (positive).

**float**– The**float data type**is a single-precision 32 bit IEEE 754 floating point. The float has a minimum value of 1.401298464324817E-45f and a maximum value of 3.4028234663852886E38f.

**double**– The**double data type**is a double-precision 64 bit IEEE 754 floating point. The double has a minimum value of 4.9E-324 and a maximum value of 1.7976931348623157E308.

**boolean**– The**boolean data type**has only two possible values: true and false.

**char**– The**char data type**is a single 16 bit Unicode character. The char has a minimum value of 0 and a maximum value of 65535.