title: Object life cycle in java and memory management?
body: <p>For the below statement in a program, how many objects will be created in heap memory and in the string constant pool?</p>
  
  <p>I need clarity in object creation. Many sources I've read are not elaborating. I am confused when the object gets destroyed.</p>
  
  <pre><code>String a="MAM"+"BCD"+"EFG"+"GFE";
  </code></pre>
  
  <p>How many objects will be created?</p>
  
  <p>I am looking for good material about the life cycle of objects, methods and classes and how the JVM handles them when they are dynamically changed and modified.</p>