title: Prototype Pattern in Java - the clone() method
body: <p>So, I've been reading on Design Patterns and the Prototype Patterns confuses me. I believe one of the points of using it is avoiding the need for using the <strong>new</strong> operator. Then I look at this example:</p>
  
  <p><a href="http://sourcemaking.com/design_patterns/prototype/java/1" rel="noreferrer">http://sourcemaking.com/design_patterns/prototype/java/1</a></p>
  
  <p>First, Their idea of Prototype implements a clone() method, which is weird. Wikipedia also says I need a pure virtual method clone to be implemented by subclasses (why?). Doesn't Java already provide such a method, doing exactly what we need it to do (which is to create a copy of an object instead of instancing it from scratch)? Second, the clone method invokes the operator <strong>new</strong>! Surely the example is wrong? (In that case I should be studying Design Patterns elsewhere, heh?). Can someone tell if this correction makes it right?:</p>
  
  <pre><code>static class Tom implements Cloneable implements Xyz {
      public Xyz    cloan()    {
        return Tom.clone(); //instead of new I use clone() from Interface Cloneable
      }
      public String toString() {
        return "ttt";
      }
    } 
  </code></pre>
  
  <p>Any clarification is appreciated.</p>