What are the different types in Java?
Author: Deron Eriksson
Description: This Java tutorial lists the different types in Java.
Tutorial created using: Windows XP || JDK 1.6.0_10


Expressions and variables in JavaSW have types. The two categories of types are primitive types and reference types. There is also a null type. The primitive types are boolean, byte, short, int, long, char, float, and double. The reference types are classes, interfaces, and arrays.

The primitive types can be broken down to boolean and the numeric types. The numeric types can be broken down into integral types and floating point types. The integral types are byte, short, int, long, and char. The floating point types are float and double.

The boolean type can be true or false. The byte type is 8-bit (-128 to 127). The short type is 16-bit (-32,768 to 32,767). The char type is 16-bit unsigned (0 to 65,535 - \u0000 to \uffff). The int type is 32-bit (-2,147,483,648 to 2,147,483,647). The long type is 64-bit (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807). The float type is 32-bit. The double type is 64-bit.