We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d634b66 commit 31ad98dCopy full SHA for 31ad98d
1 file changed
Basics/src/com/copy/Student.java
@@ -50,5 +50,7 @@ protected Object clone() throws CloneNotSupportedException {
50
// 深拷贝
51
Student student = new Student(new Subject(subject.getName()), name);
52
return student;
53
+ // 因为它是深拷贝,所以你需要创建拷贝类的一个对象。
54
+ // 因为在Student类中有对象引用,所以需要在Student类中实现Cloneable接口并且重写clone方法。
55
}
56
0 commit comments