如题,谢谢高手帮助

解决方案 »

  1.   

    个人建议:
    通过objectinputstrem读取文件中的序列化对象,把他们还原成对象以后,然后修改对象的值,再重新写
      

  2.   

    把整个文件重新写过。这是ObjectInputStream和ObjectOutputStream的一个默认限制,不能向一个文件写入两个对象。
      

  3.   


    public class eg extends Jframe implement ActionLister 

        jtextArea text=new Jtextrea(10,10); 
        Jbutton button=new Jbutton("保存"); 
        String file="D:/you.txt"; 
        public eg() 
        { 
          this.add(text,Borderlayout.center); 
          this.add(button,Borderlayout.south); 
          button.AddactionLister(this); 
          myget();\\取文件里的内容 
          this.sevisable(true); 
          this.setdefaultco.........(Jframe.Exitor...); 
        } 
        public void myget() 
        { 
          try 
            { 
            Objectinputstream oi=new Objectinputstream(new Fileinputstrame(file)); 
            text.settext(oi.readObject().tostring()); 
            oi.close(); 
            } 
            catch(Ex......... e) 
          {         } 
        } 
        事件实现里这样写(A... e) 
      { 
          if(e.getActionCommon.equals("保存") 
            { 
                try 
                  { 
                  Objectoutputstream oo=new Objectoutputstream(new Fileoutputstrame(file)); 
                  oo.writerObject(text.gettext()); 
                  oo.close(); 
                  } 
              catch(Ex......... e) 
              {} 
            } 
      } }