title: Where is allocated variable reference, in stack or in the heap?
body: <p>I have a question</p>
  
  <p>What happend when I declare a variable inside a method, for example.</p>
  
  <pre>
  void myMethod() {
      Ship myShip = new Ship();
  }
  </pre>
  
  <p>Where is allocated myShip reference, in stack or in the heap ?</p>
  
  <p>I think in stack but I'm confused because I was reading in J2ME Game Programming book
  "Java classes are instantiated onto the Java heap"</p>
  
  <p>All java clases ?</p>
  
  <p>Thanks in advance</p>