title: Memory allocation for classes in java
body: <p>This is a working java code which is used for implementing trie data structure.</p>
  
  <pre><code>class TrieNode {
  TrieNode[] arr;
  boolean isEnd;
  // Initialize your data structure here.
  public TrieNode() {
      this.arr = new TrieNode[26];
  }
  </code></pre>
  
  <p>What I don't understand is how the memory allocation works with</p>
  
  <pre><code>TrieNode[] arr;
  </code></pre>
  
  <p>code. If it were something like this</p>
  
  <pre><code>class TrieNode {
      int[] arr;
      boolean isEnd;
      // Initialize your data structure here.
      public TrieNode() {
          this.arr = new int[26];
      }
  </code></pre>
  
  <p>I know that this allocates memory for 26 integers. 
  It's better if you can explain how the memory allocation works for first code.
  (In compiler's perspective)</p>
  
  <p>EDIT : Sorry if my question is unclear.What im asking is we create array with 26 elements in </p>
  
  <pre><code>new TrieNode[26];
  </code></pre>
  
  <p>How much memory is allocated?</p>