So in a language like C, memory is separated into 5 different parts: OS Kernel, text segment, static memory, dynamic memory, and the stack. Something like this:
In Java, a static
variable exists as part of the class object. Think of it as an instance variable for the class itself. In your example, a
is a reference variable, which refers to some array (or no array at all, if it is null
), but the array itself is allocated as all arrays are in Java: off the heap.