title: how can this downcast works:(B)super.clone()?
body: <pre><code>class A { 
  
  }
  public class B extends A {
  
  public static void main(String[] args) {
       A m = new A();
       B n = (B)m;
  }
  }
  </code></pre>
  
  <p>this code can not be complied. However, in the code below, this downcast works.</p>
  
  <pre><code> class A { 
  
  }
  public class B extends A implements Cloneable{
  
  @Override
  public B clone() throws CloneNotSupportedException {
  return (B)super.clone();
  }
  public static void main(String[] args) {
       B m = new B();
       B n = m.clone();
  }
  }
  </code></pre>
  
  <p>so, why this downcast works?</p>
  
  <p>=============Correction============================</p>
  
  <p>sorry for my fault, it should be <code>B n = **(B)**m;</code>, not <code>B n = m;</code>.
  I'm very sorry. I have corrected it in the above code.</p>