Primitive Gosu types
Gosu supports the following Java primitive
types, which are provided for compatibility with existing Java code.
From Gosu, you can access the Java object versions (non-primitives) of
the Java primitive types. For example, java.lang.Boolean
is an object type that wraps the behavior of the boolean primitive. Primitive types
perform better in terms of performance and space compared to their object
versions.
The following table compares primitive types and object types.
Type |
Primitive types |
Object types |
|---|---|---|
Extends from Object class |
• | |
Can reference an object |
• | |
A variable of this
type could contain |
• | |
Exposes methods |
• | |
Exposes properties |
• | |
Can be a member of a collection |
• |
The following table lists the Java primitives that you can access from Gosu. The table mentions IEEE 754, which is the Institute of Electrical and Electronics Engineers standard for binary floating-point arithmetic.
Primitive |
Type |
Value |
|---|---|---|
|
Boolean value |
|
|
Byte-length integer |
8-bit two’s complement |
|
Single character |
16-bit Unicode |
|
Double-precision floating point number |
64-bit (IEEE 754) |
|
Single-precision floating point number |
32-bit (IEEE 754) |
|
Integer |
32-bit two’s complement |
|
Long integer |
64-bit two’s complement |
|
Short integer |
16-bit two’s complement |
See also
