Yep, an array is an object , so it gets the space allocated on the heap .
Each type of array, including primitives, has a class. Therefore, when you create an array of primitives int
, the JVM creates an instance int[].class
on the heap.
source
share