How objects are added to data structures - is just their reference added?
<p>When adding an object to a data structure the reference to the object is always added, not the object itself. So below code snippets are fundamentally the same ? </p>

<pre><code>Snippet 1 - 
    Object objectRef = new Object();   
    Vector vector = new Vector();
    vector.add(objectRef);
    Object object = (Object)vector.get(0);

Snippet 2 -
    Vector vector = new Vector();
    vector.add(new Object());
    Object object = (Object)vector.get(0);
</code></pre>
