Java example for Cloneable interface

//  Simple example which I found for cloneable and improve just to practise Java 😀
// If you have some notes on my implementation I will be happy to hear them.
package cloneable;
// Refered object from class for cloning
class Department implements Cloneable {
public Department(String departmentName){
this.departmentName = departmentName;
}
protected Object clone() throws CloneNotSupportedException {
Department dep = new Department(this.departmentName);
return dep;
}
private …

Java example for Cloneable interface Read More »