62,628
社区成员
发帖
与我相关
我的任务
分享 public void Test2(){
ObjectInputStream o=null;
Person p4;
try {
o=new ObjectInputStream(new FileInputStream("liuliu.txt"));
Object oo=o.readObject();
p4=(Person)o.readObject();
System.out.println( p4);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
o.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
p4=(Person)o.readObject();
已经读入到oo, 为何再次读入?