When you declare a variable, you explicitly set the variable's name and data type. The Java programming language has two categories of data types: primitive and reference. This table shows all of the primitive data types:
Keyword Description Size/Format (integers) byteByte-length integer 8-bit two's complement shortShort integer 16-bit two's complement intInteger 32-bit two's complement longLong integer 64-bit two's complement (real numbers) floatSingle-precision floating point 32-bit IEEE 754 doubleDouble-precision floating point 64-bit IEEE 754 (other types) charA single character 16-bit Unicode character booleanA boolean value ( trueorfalse)true or false Reference types are arrays, or names of classes or interfaces.
The variable declaration also implicitly sets the variable's scope, and you may optionally provide an initial value for the variable within its declaration. The value of a final variable may not change after it's initialized.
Note: bit - short for binary digit, the smallest unit of information on a machine. The term was first used in 1946 by John Tukey, a leading statistician and adviser to five presidents. A single bit can hold only one of two values: 0 or 1. More meaningful information is obtained by combining consecutive bits into larger units.