title: Java memory questions about 'new' keyword
body: <p>What happens if you run the following code..</p>
  
  <pre><code>while (true) {
      String x = new String("ABC");
  }
  </code></pre>
  
  <p>in terms of memory?</p>
  
  <p>Is String x allocated on the stack or on the heap? Will the program eventually crash because of a memory overflow, or will garbage collection prevent that? Does the new keyword always create the object on the heap? When is an object created on the stack? </p>
  
  <p>Thanks!</p>