Instance variable heap or stack ? ( with specific example) : <p>With the following code:</p>

<pre><code>public class Main {
    public static void main(String args[]) {
        A objectA = new A();
        objectA.deleteB();
    }
}

public class A {

    private B objectB;

    public A() {
        this.objectB = new B();
    }

    public void deleteB() {
       this.objectB = null;
    }
}

public class B {
   public B() {}
}
</code></pre>

<p>The first frame in the stack is for main()</p>

<p>with local variable objectA  in the stack that contain reference to real Object A in the heap and in Object A in the heap we have a reference Object B pointing the real Object B also in the heap.</p>

<p>The question is for the second frame in the stack deleteB()</p>

<p>In the method I do: this.objectB = null;</p>

<p>what does it mean in the memory ?</p>
