提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
实现Cloneable接口
class Clone implements Cloneable { int a; /* 来自 nowjava - 时 代 Java*/ Clone(int a) { this.a = a; } public static void main(String[] args) throws CloneNotSupportedException { Clone c = (Clone) new Clone(10).clone(); System.out.println(c.a); } }