序列化
public class User implements Serializable {
//这个序列化id,使得这个类在网络中传输也可以让接收方的JVM识别为同一个类
private static final long serialVersionUID = 1L;
private String name;
private String age;
public User(String name, String age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
@Override
public String toString() {
return "User{" +
"name='" + name + '\'' +
", age='" + age + '\'' +
'}';
}
}