clone()

要使用clone()方法,需要两个步骤

  1. 实现Cloneable接口(标志性接口)
  2. 重写clone() ```java public Person implements Cloneable{ int age = 8; int score = 100;

    @Override public Object clone() throws CloneNotSupportedException {

    1. return super.clone();

    }

}

``` image.png