Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In java you always assign something on the <strong>right</strong> to a reference to the <strong>left</strong>.</p> <p>So you statements say something like this:</p> <ol> <li>Assign the new <code>Date</code> object <code>Date(12, 31, 1999)</code> to the variable <code>a</code></li> <li>Assign the new <code>Date</code> object <code>Date(91, 1, 2011)</code> to the variable <code>b</code></li> <li>Assign the reference of variable <code>a</code> to variable <code>b</code>.</li> </ol> <p>So it looks like this if I follow those steps:</p> <ol> <li><p><code>a</code> -> <code>Date(12, 31, 1999)</code></p></li> <li><p><code>a</code> -> <code>Date(12, 31, 1999)</code> <code>b</code> -> <code>Date(1, 1, 2011)</code></p></li> <li><p><code>a</code> -> <code>Date(12, 31, 1999)</code> <code>b</code> -> <code>Date(12, 31, 1999)</code></p></li> </ol> <p>Please note that after this assignment the original object of <code>Date(1, 1, 2011)</code> is no longer referenced since you cannot reach it from your application. Its original referencing variable <code>b</code> is overwritten and now the object <code>Date(12, 31, 1999)</code> is referenced from both <code>a</code> and <code>b</code>. <code>Date(91, 1, 2011)</code> is <em>orphaned</em> and ready to be garbage collected.</p> <p><em>Imagine this as if you were holding a sword and an axe. First you pick up a sword. Then you pick up the axe. After that you drop the sword and drag the axe you still have in your hand with both hands. After that you do not hold the sword you dropped (it is lost).</em></p> <p><strong>Edit: This is an error if you tell the author of the book he will be grateful.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload