title: Memory allocation of class objects
body: <p>I have been asked this question in interview. Please help me find its answer.</p>
  
  <p>Suppose you have a class Employee. There are 2 variables in it - 1. String Name 2. Int Age</p>
  
  <p>Now, <code>Employee emp = new Employee();</code></p>
  
  <p>Now the Questions asked are :</p>
  
  <ol>
  <li>Where the object emp stored in memory i.e in stack or heap and how ?</li>
  <li>Where the name and age variables stored in memory and how?</li>
  <li>What does each word in this statement do i.e what does employee do..then emp..then =.. then new.. then employee.. then ()..then ;</li>
  <li>What is the difference between the above statement and Employee emp; ? Tell in terms of memory allocation.?</li>
  </ol>
  
  <p>Please reply with your valuable comments.</p>