A variable could be declare as one of them.
|byte||8-bit signed integer|
|short||16-bit signed integer|
|int||32-bit signed integer|
|long||64-bit signed integer|
|float||32-bit floating point|
|double||64-bit floating point|
|boolean||True or false|
|char||16-bit Unicode character|
|String||Sequence of characters|
Note that when declaring variables of type
f suffix must be added to the value to indicate that it is a floating point value. When declaring variables of type
L suffix must be added to the value to indicate that it is a long integer value.
String is not a primitive data type in Java, but it is often used as if it were one. A
String is actually an object, but Java provides special support for
String objects, making it easy to use them in a way that is similar to primitive data types.