title: Where array of primitives stored in JVM memory
body: <p>JVM memory is divided into:
  1. Method Area
  2. Heap Area
  3. Stack
  4. PC Register
  5. Native Stack</p>
  
  <ol>
  <li><p>Now suppose I have a class having property of say "int[] dealCodes"(array of int primitive). As per memory management once deal code is initialized, there would be contiguous memory allocation of (total_elements * 4 bytes) in memory. So if array size is 10 then there will be 40 bytes allocation in JVM memory.</p>
  
  <p>My question is in which area this 40 bytes will be allocated (heap or stack)?</p>
  
  <p>My understanding about array is: it's just like any other object and resides under heap area but don't know about primitives to which array points to.</p></li>
  <li><p>Also want to know about similar scenario when array holds references (e.g. array of type Employees). I think in this case, everything will be in heap area. As these are references then array will hold 4 bytes for each reference (32 bit system) and these references will point to objects of varying size. 
  Array memory allocation will be calculated on basis of reference size not object size.</p></li>
  </ol>
  
  <p>Please help me to get clarity on above 2 points.</p>