Here is an example of copying a resume.
Package COM. WZS. design;/*** big talk design mode -- page88 prototype mode ** @ author administrator **/public class prototypepattern {public static void main (string [] ARGs) throws clonenotsupportedexception {workexperience = new workexperience ("2011-2-2", "2013-3-3", ""); resume a = New resume ("", "male ", "23", workexperience); resume B = (resume). clone (); workexperience workexperience2 = new workexperience ("2011-2-2", "2013-3-3", "Google China"); B. setworkexperience (workexperience2); resume c = (resume). clone (); C. setage ("99");. display (); B. display (); C. display () ;}/ ** resume */class resume implements cloneable {private string name; private string sex; private string age; private workexperience; public resume (string name, string sex, string age, workexperience) {This. name = Name; this. sex = sex; this. age = age; this. workexperience = workexperience;} public void display () {system. out. println ("name:" + name + "Sex:" + sex + "Age:" + age + "" + workexperience) ;}@ overrideprotected object clone () throws clonenotsupportedexception {return Super. clone ();} Public String getname () {return name;} public void setname (string name) {This. name = Name;} Public String getsex () {return sex;} public void setsex (string sex) {This. sex = sex;} Public String getage () {return age;} public void setage (string age) {This. age = age;} public workexperience getworkexperience () {return workexperience;} public void setworkexperience (workexperience) {This. workexperience = workexperience;}/** work experience */class workexperience {private string workdatastart; // work start time private string workdataend; // work end time private string company; // company public workexperience (string workdatastart, string workdataend, string Company) {This. workdatastart = workdatastart; this. workdataend = workdataend; this. company = company;} Public String getworkdatastart () {return workdatastart;} public void setworkdatastart (string workdatastart) {This. workdatastart = workdatastart;} Public String getworkdataend () {return workdataend;} public void setworkdataend (string workdataend) {This. workdataend = workdataend;} Public String getcompany () {return company;} public void setcompany (string Company) {This. company = company ;}@ overridepublic string tostring () {return "Start Time:" + workdatastart + "End Time:" + workdataend + "company name:" + company ;}}