title: Java primitive types and objects structure in memory
body: <p>When we create a Java primitive variable or a Java object, how it is represented/structured in memory ?</p>
  
  <pre><code>int A;
  </code></pre>
  
  <p>// is a reference to an integer type created ? <br>
  // is the memory space necessary to hold an integer type allocated in memory ?</p>
  
  <pre><code>A = 3;
  </code></pre>
  
  <p>// is it now that the memory space necessary to hold an integer type is allocated ? then A reference that space.</p>
  
  <pre><code>int B = 2;
  A = B;
  </code></pre>
  
  <p>// is A referencing the memory location as B ? and the old memory location that was referenced by A is Garbage Collected ? <br>
    // if yes, then modifying A will result in modifying also B, correct ? <br>
    // if no, then a pass by value has been done. <br>
      // has the memory location referenced by A been modified, or a new memory location capable of holding int has been created, filled with the value referenced by B then getting referenced by A ? <br></p>
  
  <p>Is it the same analogy if A was a class object ?</p>