3.2. The Java primitive types
Last updated: 23 January 2013.
Primitive types are not objects but rather simple predefined types. As I said in the first tutorial, Java is derived from the C language and in fact, the primitive types of Java are the types inherited from the C language (except the type boolean which does not exist in C). Here is the complete list of primitive types available in the Java language:
|Type||Size (in bytes)||Range|
|boolean||1||true and false|
|char||2||The complete list of Unicode characters|
|byte||1||Integer ranging from -128 to 127|
|short||2||Integer ranging from -32 768 to 32 767|
|int||4||Integer ranging from -2 147 483 648 to 2 147 483 647|
|long||8||Integer ranging from -9 223 372 036 854 775 808 to +9 223 372 036 854 775 807|
|float||4||Floating point ranging from 1.4e-45 to 3.4e38 (positive or negative)|
|double||8||Floating point ranging from 4.9*e-324 to 1.7*e308 (positive or negative)|
The next tutorial discusses the variables and blocks of the Java language.