title: Where does java reference variable stored?
body: <p>How does Java's reference variable stored? Is that work similar to C pointer?</p>
  
  <p>what I mean by reference variable is myDog in this code</p>
  
  <pre><code>Dog myDog = new Dog();
  </code></pre>
  
  <p>I understood about C pointer, it stores in the heap if global variable, and it stores in the stack if local variable. I wonder java works same way. </p>