如果new出来两个对象,然后相继把这两个对象写进文件(进行序列化),但是要是想犯序列化的话因为有两个对象,应该怎么操作呢?
比如说一下程序:
try{
testImformation ti = new testImformation("54080721","xxxxxxx","1234556");
testImformation ti2 = new testImformation("54080710","xxxxxxx","345361");
FileOutputStream fos = new FileOutputStream("F:\\java\\testImformation.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(ti);
oos.writeObject(ti2);
}catch(IOException e){
e.printStackTrace();
}
怎么把它们反序列化呢?两个对象?更多呢? |