Appendix D. Some Java details
Java data types
Java knows two kinds of types: primitive types and object types. Primitive types are stored in variables directly, and they have value semantics (values are copied when assigned to another variable). Object types are stored by storing references to the object (not the object itself). When assigned to another variable, only the reference is copied, not the object.
Primitive types
The following table lists all the primitive types of the Java language:
Type name | Description | Example literals | ||
---|---|---|---|---|
Integer numbers | ||||
| byte-sized integer (8 bit) |
|
| |
| short integer (16 bit) |
|
| |
| integer (32 bit) |
|
| |
| long integer (64 bit) |
|
| |
Real numbers | ||||
| single-precision floating point |
| ||
|
Get Introduction to Programming with Greenfoot: Object–Oriented Programming in Java™ with Games and Simulations, First Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.