日期:2014-05-20  浏览次数:20727 次

读取序列化内容并修改
File f = new File("E:" + File.separator + "Num12.txt");
FileInputStream fis = new FileInputStream(f);
ObjectInputStream ois = new ObjectInputStream(fis);
Object obj = ois.readObject();
System.out.println(obj);  
ois.close();
fis.close();

值已经读取了 怎么修改并再次保存到文件中?是重复序列化的操作吗?

------解决方案--------------------
修改后,重新用 writeObject()写入文件
------解决方案--------------------
探讨
File f = new File("E:" + File.separator + "Num12.txt");
FileInputStream fis = new FileInputStream(f);
ObjectInputStream ois = new ObjectInputStream(fis);
Object obj = ois.readObject();
System.out.……