public void setUserName(String userName) {
this.userName = userName;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Override
public String toString() {
return "ConcretePrototype [userName=" + userName + ", age=" + age + "]";
}
}
测试类/客户端类:
public class PrototypeTest {
public static void main(String[] args) throws CloneNotSupportedException {
ConcretePrototype concretePrototype = new ConcretePrototype("EagleLi", 23);
System.out.println(concretePrototype);