Delete core-java-modules/core-java-lang-oop-patterns/src/main/java/com/baeldung/shallowdeepcopy/School.java

This commit is contained in:
Neetika23 2023-10-27 14:49:09 +05:30 committed by GitHub
parent 9f1ce56f82
commit 002def2d24
1 changed files with 0 additions and 22 deletions

View File

@ -1,22 +0,0 @@
package com.baeldung.shallowdeepcopy;
class School {
private String schoolName;
public School(School sc) {
this(sc.getSchoolName());
}
public School(String schoolName) {
this.schoolName = schoolName;
}
// standard getters and setters
}
@Override
public Object clone() {
try {
return (School) super.clone();
} catch (CloneNotSupportedException e) {
return new School(this.getSchoolName());
}
}