SE450: Java: Reference Types [16/22] ![]() ![]() ![]() |
References in Java are 32-bit pointers. They hold indirect references to Object or Array instances
Java treats an Array of any type as an Object
Reference types (objects) are created on the heap. Unlike C++, there are no ways to manipulate this reference to point to different places in memory, or perform pointer arithmetic on it.
Items created on the heap are garbage collected. Since Java 1.2, you have been able to have some control over when things are GC'd using the Reference Object API. But even with some control over GC, Java far from a Real Time environment.
Primitive types are created on the stack