title: Memory allocation of string Builder. What happens in memory? StringBuilder vs String
body: <p>Possibly a duplicate as there are a lot of questions on this topic but I couldn't find what I was looking for.</p>
  
  <p>I know <code>String</code> is immutable and <code>StringBuilder</code> is mutable. And I understand the essence of these two terms. I wanted to know what exactly happens in the memory when I create an instance of <code>StringBuilder</code>. Like:</p>
  
  <pre><code>StringBuilder s = new StringBuilder();
  </code></pre>
  
  <ol>
  <li>How much space is reserved for s in the memory ?</li>
  <li>I can use it like <code>s[0] = 'a';</code> so can we call s an array ? </li>
  <li>If s is index-based does that mean characters are stored in memory on consecutive locations ? </li>
  <li>If answer to 3 is yes. Then what happens if we use <code>s.Append("abc");</code> and there isn't enough consecutive space in memory for <code>"abc"</code> ? Will it take <code>s</code> to a new memory location just like what happens with <code>string</code> every time we append something to <code>string</code> type variable?</li>
  </ol>