- Back to Home »
- Java Data Types
The Java language contains the following primitive data types:
Description | |
byte | 8 bit signed value, values from -128 to 127 |
short | 16 bit signed value, values from -32.768 to 32.767 |
char | 16 bit Unicode character |
int | 32 bit signed value, values from -2.147.483.648 to 2.147.483.647 |
long | 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808 |
float | 32 bit floating point value |
double | 64 bit floating point value |
That these are primitive data types means that they are not objects. Classes and objects are explained later. The primitive types also come in versions that are objects, meaning you can call methods on them, like on any other object in Java.
Java also contains a few core data types which are objects. Here is a list of those types, including the object versions of the primitive types.
Description | |
Byte | 8 bit signed value, values from -128 to 127 |
Short | 16 bit signed value, values from -32.768 to 32.767 |
Character | 16 bit Unicode character |
Integer | 32 bit signed value, values from -2.147.483.648 to 2.147.483.647 |
Long | 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808 |
Float | 32 bit floating point value |
Double | 64 bit floating point value |
String | N byte Unicode string of textual data. Immutable |
Notice how object types are spelled with a capital letter in the beginning of their name.
There are of course many other components you can use in the Java API, but the above mentioned data types are the core Java types.
You can also create your own more complex data types by creating custom classes.