title: Java Defensive Copies
body: <p>I've seen defensive copies coded like this</p>
  
  <pre class="lang-js prettyprint-override"><code>void someMethod(Date d) {
      myDate = new Date( d.getTime() );
  }
  </code></pre>
  
  <p>But that doesn't make sense to me, isn't there a way in Java to create an identical copy in memory of that object? </p>
  
  <p>I've read the <code>clone()</code> will not work in all instances, but I don't understand why.</p>