String detail;
public Address(String detail){this.detail = detail;
}}
int age;}
Address address;
public User(int age){this.age = age;}
address = new Address("SZ");
public User clone()throws CloneNotSupportedException{return (User)super.clone();}
public static void main(String args[])throwsCloneNotSipportException{}User u1 = new User(29);}
User u2 = u1.clone();
System.out.println(u1==u2);//false
System.out.println(u1.address==u2.adress);//true
联系客服