title: where is array saved in memory in java?
body: <p>If I have a function that in that function I declare:</p>
  
  <pre><code>Object arr[] = new Object[20];
  </code></pre>
  
  <p>Where are arr and the whole array stored? heap? stack?
  Does it matter if the declaration is in some function or in main()?</p>
  
  <p>and let's say I also have these command lines:</p>
  
  <pre><code>arr[0] = new String("abc");
  arr[1] = new List();
  </code></pre>
  
  <p>where are <code>arr[0]</code> and <code>arr[1]</code> stored?</p>