代码拉取完成,页面将自动刷新
package cc.openhome;
import java.io.*;
public class Member2 implements Serializable {
private String number;
private String name;
private int age;
public Member2(String number, String name, int age) {
this.number = number;
this.name = name;
this.age = age;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return String.format("(%s, %s, %d)", number, name, age);
}
public void save() throws IOException {
try(ObjectOutputStream output =
new ObjectOutputStream(new FileOutputStream(number))) {
output.writeObject(this);
}
}
public static Member2 load(String number)
throws IOException, ClassNotFoundException {
Member2 member;
try(ObjectInputStream input =
new ObjectInputStream(new FileInputStream(number))) {
member = (Member2) input.readObject();
}
return member;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。